A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
New Unity Live Help updates. Check them out here!
Discussion in 'Assets and Asset Store' started by Tryz, Feb 21, 2014.
Interesting! Yeah, last I knew the secret solution was to go with mixed.
EDIT Solved: I set the mecanim transition parameters up wrong. Public humiliation is my favourite
Hi guys! I've got a potentially chewy problem that I've run into a brick wall with.
I've tampered with the PSS_Utilities SSM and PSS_Damaged scripts to transition to different states depending on which attack has connected - it passes the Attacker's CurrentAttackStyleForm into the Defender's layer's MotionParameter to determine which animation to play, effectively.
However, in my testing I've come up against a strange bug - the MotionController sets all of the relevant animator parameters and then does not transition into the relevant state, effectively seizing up and getting stuck in whatever state that mecanim is in at the point of Activate() being called. Even stranger, it DOES transition into the correct state when I don't Deactivate the Attacker's BasicMeleeAttack, which is on a different game object entirely.
My noodle is full baked trying to untangle this. Anybody run into a similar problem before?
If anyone wants to try using UMA with Motion Controller, this might get you started:
You're the best!
I feel like I've seen this answered somewhere, but can't recall where, so please forgive the dumb question.
My question is about "friendly fire", is there a workflow so that the MC only damages enemies and not "teammates"/allies?
Would this be under the combatant?
Hey @rubble1 ,
It's actually on the bullet component that's on the gun. With it, you can set the collision layer that the gun's ray will collide with.
With this approach, you can put your players and NPCs on different layers or you can do it by teams and there won't be friendly fire. It does mean that your gun will be different between the groups as the bullet component will be different.
That really is awesome! Thank you for helping.
Cool, I see. I don't have the shooter pack yet, but plan on getting it.
Is there something like this on the sword core? How would I get this on a melee attack?
Swords (using the Weapon Core) determine a hit in two ways:
1. Unity colliders
With this approach, we're just using standard Unity colliders and reacting to Unity's OnTriggerEnter() function. So, there's no way for me to stop that as it's happening through Unity's physics system.
What you can do is tell Unity's physics system to ignore collisions on layers, but this is a global setting (which may be fine for your game).
2. Field of Attack
Here I'm determining collisions through the QueryCombatTargets() function I created.
It looks my my function does support layer filtering, but I never pass the filter in. That should be an easy enough fix as I'll add that filter to the Combatant. I need to think about it more, but that seems right.
If you're using approach #1, you can filter now. If you're using approach #2, you'll have to wait for me to add it... probably this weekend.
Hi Tim, sorry to bring up an irrelevant topic but I wasn't quite sure where I could post for the EasyInput Asset. Just a quick question, Is there a way for the asset to capture an event system when the input has changed from say keyboard/mouse to joystick?
I don't have an event for that, but you could poll for it pretty easily.
If you look at my EnumInput.cs, you'll see that the Xbox values are 170-187.
So, a function like this should work:
for (int i = 170; i <= 187; i++)
if (InputManager.GetValue(i) != 0)
Thanks Tim, now to add some RUMBLE to the input class. I'll try and adapt the XInputInterface.dll and SetVibrations to a derived class thanks for pointing me towards the proper direction. You Rock!!
I've been having some problems with frame rate dropping during attack animations. It only happens in the editor, and it comes on progressively. Initially it's fine, but the longer the game runs the more performance drops, only during attack anims, until it's pretty much unplayable. And it's fine, no problems at all, if I build the game and run that, only happens in the editor. Still, it's quite annoying... Profiling suggests it's due to some sort of garbage collection on the Actor Controller (as far as I understand it).
Any suggestions as to what might be going on, or where I might look for a solution?
I've played around a bit, but I'm not seeing any garbage building up (other than Unity GUI stuff).
Lets take this offline as it could be something specific to your project.
Please email email@example.com the following:
1. Your Unity Order ID for the MC and SSMP
2. A screen shot of a Deep Profile showing the garbage
3. Which mode of combat you're using: field-of-attack or colliders
To be consistent, let's use a fresh Unity project (2017.3.0f3) with the demo_SSMP and "Enemy (0)" disabled. This way we're looking at the same thing.
I'm sure we can figure this out.
Great, thanks for the super fast reply! I'll get a fresh project setup during the weekend at some point, and get back to you by PM...
Ahhh, just discovered what was happening, just me being careless - I had the debug view on for my attack motions, but hadn't noticed because I had a new camera that didn't have the graphics manager added yet. I guess it's normal to have a framerate drop for the combat animations like that...? In any case, turning off the debug view has everything back to normal...
The Graphics Manager is what clears the debug info each frame. Without it, we're drawing to the Scene View but never clearing it.
It didn't happen in production because the debug info isn't drawn in a real build even if you have the debug view enabled.
Glad you found that.
I've created a clean project to work a bit with Node Canvas and Motion Controller.
Just imported Node Canvas, Motion Controller, Sword and Shield pack and then the Ootii Node Canvas integration package from the Vault.
I have critical errors that forbid me to do anything (attached to this post), is it because NC is version 2.8 or did I miss something?
Unfortunately NC's update had "breaking changes". That's what you're seeing.
I have to update my integration to compensate for his changes. I'm hoping to look at it soon... ie the next week or two.
I'll put a note on the Vault.
In the meantime, if you do a solution-wide search (in Visual Studio) for EditorUtility.BBParameterField and replace it with BBParameterEditor.ParameterField (and update the "usings" in each file; Visual Studio should prompt you with the correct action when you hover the mouse cursor over the new text), then it fixes the problem.
I'm really not good at coding, but your solution worked perfectly! thanks for that seriously
I've updated the files and sent to Tim the package with those fixes so he can maybe update the Vault sooner if anyone has the same issue
for me i think it's the camera controller
Thanks @Necka_ and @TeagansDad . I'll look at the changes and get them up.
The profiler is great, but you have to actually look at what's happening...
In the first image, the garbage is coming from Unity's GameObject.GetComponent() function and only occurs in the editor. It doesn't occur in built games. This has been documented a couple of times.
In the second image, you're reporting on the initialization of the game which is always processor heavy. This is a one-time event that happens when the scene starts and it deserializes the motors. Notice the "CameraController.InstantiateMotors()" function you have highlighted.
I'll look at the deserializing of the motors, but I doubt there's much that can be done since there's so much string manipulation going on (JSON parsing). Again, it only happens once when the scene first loads and the camera initializes... so, it really isn't an issue.
I should add that for the second one, it can happen again in the editor when you view the inspector for the CC since motors are serialized and deserialized by the inspector. But, again, this is only in the editor and doesn't happen in builds.
One additional thing that I missed... when you update the using statement (using NodeCanvas.Editor) for the BBParameterEditor.ParameterField you must ensure that it gets placed inside an #if UNITY_EDITOR define statement. It won't generate any compile errors until you perform a build; when you do try and build, it will throw an error, stating that "The type or namespace name 'Editor' does not exist in the namespace 'NodeCanvas.' Are you missing an assembly reference?" This is because the Editor-only code does not get included in a build (any files within a folder named "Editor" as well as any code located in an #if UNITY_EDITOR define).
Most (or all) of the files that needed the change also reference the UnityEditor assembly anyway, so you can move the using NodeCanvas.Editor into the same block:
Hey, that's actually funny because that's something I found out yesterday while doing a test build. I sent a mail to Tim about this as I don't need to build anything right now; but thanks for the information; if I do need to build before the official update I'll paste that into the scripts
Thanks to @TeagansDad and @Necka_ the Node Canvas integration is now updated on the Vault. I've tested it in the editor and in a build.
Just head to the Vault to get the latest and greatest.
There's a lot of people on this thread that really go out of their way to help others and I want to say "Thanks!" to all of you.
But, today I want to give a special 'super thanks' to the amazing @TeagansDad ! Not only is he super helpful, but he's wicked smart and has some great ideas.
Thanks @TeagansDad ... you're super!
Now I'm blushing.
Hey all, just want to say that I just purchased the motion controller and camera rig and have to say it's very well documented and was a breeze to set up. I'm very new to Unity in general so that says quite a bit.
I'm using UMA as my character generator. I noticed there was a video here showing integration but it was actually pretty simple to set up as a player.
I'm having issues as an AI though. If I take the NavMesh example and swap out (or copy) the components from Y_Bot to an UMA character, he ends up just face-planting into the wall.
I come from a corporate programmer background so component and graph based AI frighten me; actually node-based logic in general frightens me. lol
I'd rather just code my AI in C#, but I'm unsure how to get it working with the Motion Controller for animations.
(I'd like not to have to have two separate animation solutions for NPCs vs PCs)
I think this has something to do with UMA being initialized after run time. I'm pretty sure I'll solve it myself but if anyone thinks I'm missing something painfully obvious, it might help.
Thanks, and thanks for the well documented code! (The animator still scares me though)
@Anydaytv - welcome!
If you just copied the components from an example character to the UMA character, make sure you recreate the Body Shapes on the Actor Controller. Otherwise it's still set up for the y-bot.
Also, as long as you're using the UMA Bone Builder tool, you don't need to be concerned about runtime generation, as everything needed by Motion Controller is there at design time.
Yeah, the actor controller appears to be set up correctly. Debugging information displays speed and that he's grounded...
The UMA animates, he just seems more concerned with ending his existence rather than going to the target.
Okay, found out the issue and possible bug.
Not entirely sure what the interaction is going on between the Camera Rig, the Motion Controller and the Nav Input, but they don't like each other.
This works fine for Y_Bot, but if the Camera Rig gets assigned to UMA, it looks like the Motion Controller just stops reporting the position and rotation of the UMA entity.
This works, but if I was making a point and click game, not sure how I would resolve this.
I'm curious as to why this is happening, but if anyone was having my issue, this is the fix.
Hey @Anydaytv ,
If you're coding your own AI, check out the User's Guide (page 26):
The functions like ActivateMotion(), GetMotion(), etc. will be the basis of what you use. If you're using any of my motion packs, I include some C# AI demos as well.
It's been a long time since I played with UMA, but the fact that it's working with Y_Bot and my test scene means there's something unique with your character/UMA.
There's a couple of things I can think of:
1. In your picture, it looks like the transform is at the character's center. Can you confirm that his root is really at his feet like how we'd expect?
2. Is the "Rotation Speed" on the Basic Walk Run Strafe motion of the MC high enough to rotate the character. I just tested and 120 seems high enough for my test scene, but set it to 360 just in case.
3. Make sure the Basic Walk Run Strafe's "Rotate With Camera" is not checked since the Nav Mesh Input Source is doing the rotation.
The other thing I'm wondering is if there's another transform in the UMA setup that is being used as the root and that's causing an issue.
If you want to send your project to firstname.lastname@example.org, I can take a quick look. Please include your Unity Order ID and that we're talking on the forums.
I appreciate the warm welcome
I was using the "Walk Run Pivot" animation set, when Y_Bot is using "Walk Run Strafe".
Even if I deselect "Rotate With Camera", if the Camera gets assigned he just walks off. It works if the Camera isn't assigned, but using the "Walk Run Strafe" set did the trick.
In either case, I was able to duplicate that on Y_Bot, so that was satisfying.
There might be a bug in there, I have no idea.
That explains it.
Walk Run Pivot uses the camera to determine if the input should cause the character to pivot to face the player, face left, etc. Think about how Assassin's Creed allows the character to face the camera in "adventure mode". So, the direction of the camera really matters.
This doesn't typically work well with NPCs or even top-down because the camera is usually not in the direction the player moves.
With NPCs or top-down, we use Walk Run Strafe because it allows the character to go forwards, backwards, strafe, etc. The input is then relative to the character's direction.
When hooked with the camera, typically the player and character are always facing the direction of the camera. With NPCs (and top-down games), we let the Nav Mesh Agent determine the direction using the character.
So, general rule... use Walk Run Strafe (or the new Walk Run Focus) when dealing with NPCs or top-down games.
I'm pretty sure I mention this in the videos, but I know there's a lot to learn and remember.
Yeah, I'm still learning all the quirks and having a lot of fun with it.
Right now my character seems convinced he can climb every rigid body he comes across, with typically hilarious results.
I like the fact it works out of the box.
I experienced a lot with AI movements and Motion Controller (or even character controlling from top-down with click to move); I'm no coder at all (the opposite of you actually) but if you need help with Nav Mesh and stuff, don't hesitate; I annoyed so much Tim with that, I got some good insight now
For the Climbing, you can set a layer on the motion itself to tell your character he can climb only specific stuff you put in that layer
Welcome to the Ootii's gang
I've been playing around with Reactors and CombatMessages recently, and I'm just curious - why do CombatMessages use the Interface IMotionControllerMotion, rather than just a straight MotionControllerMotion, especially since the Interface itself is empty? I'm finding I'm just recasting all the time as MotionControllerMotion anyway to be able to do anything useful... Is that bad practice on my part, or does that seem as intended?
Interfaces give us a lot more flexibility in the sense that you could create a "motion" that doesn't have to inherit from MotionControllerMotion... it just needs to implement the IMotionControllerMotion interface. I'll admit it would be very rare, but I feel like message objects should not be restrictive since I don't know what other people will use them for.
It's always a toss up on if you make something like the message object more rigid or flexible. In this case, I'm trying to allow the messages to be as flexible as possible at the cost of the cast.
So, you're doing it right.
I was looking at the Actor core to spawn particles (let say blood) when the actor receive damages.
Reading that: https://ootiigames.com/?page_id=26
So if I understood correctly I should create a reactor (Unity event proxy) that captures message ID 1107 and in the event I'd spawn the particles
Is there a simple way to get the impact location of the damages?
What you said is right.
Check out the CombatMessage.cs:
/// Point (in world-space) where the impact occured
public Vector3 HitPoint = Vector3.zero;
Does anyone have some experience with Bolt regarding 3rd party scripts like motion controller?
I'm quite ok with lots of things to control. But here I'm struggling with this public Vector3 which is "HitPoint" I really can't figure out how to capture this value.
My goal here is simply grab the variable to spawn particles from it. I'm sure it would be a 10mn script to build, but I have to do it with Bolt (or Playmaker but Playmaker you have to build actions and so on... so I'm trying to move on something more flexibe)
So maybe I'm not grabbing the proper element at all (Get Hit Point) which requires apparently a combat message; so maybe I'm all wrong from the start.
I can start this flow with an event (based on the damaged message, this part works fine)
In the screen capture in Yellow is what I think is the unit I need to work with. in Red those are basically the 3 options I have that I can input into the Get Hit Point and in Green it's the event starting the flow
I asked a bit on Bolt Discord but basically I would need to send people code or entire scripts to move forward and I don't want to do that as the code is not my property; don't want to spread it.
Unfortunately, I haven't played with Bolt yet... However, I was looking at the diagram. You shouldn't need to allocate or create the combat message. That would come as an argument of the Unity Event. The type comes in as an IMessage interface.
I'm wondering if the "Get Hit Point" node is able to take an IMessage as an input or argument. Then, the UnityEvent should be able to just pass it over. Inside "Get Hit Point", you'd do this:
Vector3 lHitPoint = ((CombatMessage)rMessage).HitPoint;
If it helps, you have my permission to send others the CombatMessage.cs file. There's no magic in there.
Thanks Tim, I'll try to ask a bit more to Bolt support/Community. Just to avoid any issue: I'm doing this graph flow on the enemy that receives the damages. Does it make sense? Or should I do it on the sword that does the damages?
Bolt devs. already seen the code, as they work with me, alot and I own Motion Controller, but they can't remember every bit of it and how things work all the time lol. I used in a game I was working on FOR Android, so the developers have also helped many other MC developers .... Its hard to see with out someone code...So that is why it was asked for... So having you send them a piece of the code or part of a script is typically required, since many custom many things as well, so with out seeing code its hard to know for sure on what is to do. Motion Controller is a great tool but no disrespect, or anything I used to code this way, some of the code is a bit, complex, so some if it when it comes to multi player can require a little more care and looking at MC's code any code you may have added, etc....Then Bolt adding, what they need to....I personally use MC, and Bolt with my Android game, and only ran into one issue, which which related to animations not always firing.. I do not use MC with my other PC Bolt game.. SO I can't comment on PC, but it shouldn't be any different.
I suggest to talk to Stanchion from Bolt, on Discord....sorry I don't have the time to look and help, wish I did and could be more helpful..but I'm sure you can get send in the right direction atleast from Bolt Discord. by visually showing them what is needed...as I said. good luck.
Thanks Recon, I'll see if the guy shows up. In the mean time someone is trying to help me. Seems we need to use Bolt Custom events (where we can add parameters)
So far it doesn't work.
I created a script (used as a wrapper to fire up the custom event in Bolt)
public class DamageEventTest : MonoBehaviour
public void DamageEvent(IMessage message)
CustomEvent.Trigger(gameObject, "CombatMessage", message);
The blocking point here (if at least the code is right for that) is to have the event to fire up.
Using the reactor Unity event proxy I got to the point where I can't see the "DamageEvent" in the list of functions (see screenshot) and that's blocking me from investigating further
well this is what I do... to be honest when working with different assets and others code like this..... this is more work, but less of a pain..... I make sure what ever your trying to do, make sure you get it working in MC..... Then, I make sure you get it working with ONLY BOLT.. no asset... Then looks like play maker as well, so make sure you test it and make sure you do the same there....Then combine them once you understand how they all work.. and they are in deed working..I work with many clients in the past, and ,many times its due to them NOT knowing how a certain asset works, or its bugged out due to something they did.... .
So that is some advice...Also hard for me to say for sure what you are after ... to be honest..Sounds like your trying to get hit detection ...working. but I may be wrong. either way I suggest doing what I said....first. good luck.
I also don't use MC's damage, I make my own. I only use MC for the bare bones. for animations motion and such, other wise everything else is custom. I wrote. not saying it wont work, Tim, made it easier with the new Reactor system. I think it called.
Thanks, I do want to just grab the HitPoint variable to then use it to spawn particles. I indeed don't know how to manipulate code but know how to use the tools you mentioned (at least it's working for most of the simple stuff I'm using). It's just that here I have no idea on how to grab this Vector3 variable in the simplest way possible (and the more I'm working on it the more it gets complicated with no results)
MC, Bolt and Playmaker are working fine, it's me who's not working fine
It's working now the guy from Bolt discord managed to find the Reactors doc on Ootii's website and figured out the custom event
Now I can get any information from the CombatMessage super easily
I attached the solution in the screenshot in case anyone in the future tries to figure that out