Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Motion Controller

Discussion in 'Assets and Asset Store' started by Tryz, Feb 21, 2014.

  1. fero_gg

    fero_gg

    Joined:
    Sep 9, 2019
    Posts:
    4
    Also a quick follow up question, I want to remap the equip rifle but whatever I change it to I have to press "4" key first to get it out, then whatever I have remapped it to will work from then on. Is this a bug i.e a hard coded 4 key somewhere in a script? Because there is no 4 set up in the unity inputs now and like I say whatever controller button I remap to works fine but only AFTER I press 4 initially, it does nothing at all if I don't press 4 first? Any ideas?
     
  2. ledshok

    ledshok

    Joined:
    Oct 28, 2012
    Posts:
    23
    I want to say I encountered something similar when I added a rigidbody to my player but forgot to set isKinematic = Y.
     
    Tryz and boysenberry like this.
  3. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    364
    Yes, isKinematic was one of the first things I looked at as well.
    What I use to fix my situation (which was most likely from UMA) was to toggle the OrientToGround boolean in my Player Start method:

    AC.OrientToGround = true;
    AC.OrientToGround = false;

    (Where AC == ActorController)

    Maybe that will be useful to others using UMA...
     
  4. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    950
    The Basic Inventory component checks for numeric key input (if that option is checked) and will toggle the equipped state of the corresponding Weapon Set. That part is hard-coded in the component. I believe that the "Toggle Equip" input will act on the first Weapon Set by default. The setup scripts place the Sword and Shield I'm that first slot, so your button is probably trying to equip a set you don't have set up on the character. If you move the rifle to the top of the Weapon Sets list, then it should respond to that input.

    You need to press '4' first so that Basic Inventory has that Weapon Set as the "current" one to be toggled.
     
    fero_gg likes this.
  5. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    950
    Make sure that your Dynamic Character Avatar component isn't adding any additional Collider, Rigid body, or CharacterController components. I haven't used UMA for a good year or longer, but the default configuration used to include recipes that add some default Unity components. That's the first thing I'd check.
     
    boysenberry likes this.
  6. fero_gg

    fero_gg

    Joined:
    Sep 9, 2019
    Posts:
    4
    Thank you sir that is so obvious now but wouldn't have thought of that in a million years! All working now thanks :)
     
    TeagansDad likes this.
  7. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    178
    Starting up a new project and added the motion controller and the archery pack to it. When the bow is equipped and I go to aim it, the player is looking way upward and when the arrow is shot, the flight follows the direction the player is looking. Where do you start to look to adjust the IK to get the arrow to shoot towards the reticle? The player in the demo scene works fine but I am using a Polytrope Studio low poly character for my project. Would it possibly be an incorrect bone structure somewhere?
     
  8. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    178
    Here is a short video showing the aiming issue. As you can see I need to aim way down in order to hit a target.




    Could this be the orientation of the bow being incorrect? i.e. i need to rotate, fix the bow?
     
  9. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    950
    You can adjust the IK settings on the Basic Ranged Attack motion.

    You probably want to have "launch from camera" selected, rather than trying to fire the arrow according to the bone rotations. That should hopefully clear up this problem.
     
  10. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    178
    I was able to get the IK adjusted to where it fires correctly without Releasing from the camera. If it releases from the camera then it shoots crazy again. I am ok with where it is right now. Maybe I will come back another time and try releasing from the camera.
     
    TeagansDad likes this.
  11. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Hey @KeithBrown ,

    When firing from the bow (vs. the camera), I'm using the finger of the right hand for the back of the arrow and the left hand for the head of the arrow. That creates the direction. It could be the character skeleton is creating an odd angle for the arrow.

    If you want to email me your project, I can take a look. I'm wondering if the hand of the character is twitching at the release or something. It's probably easier for me to poke through it... if you want.
     
  12. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    950
    @boysenberry Also, you'll want to run the UMA Bone Builder tool to create the UMA Bone structure at design time, and then regenerate the Body Shapes on the Actor Controller, to ensure that your colliders are all created properly. You may already be doing that, but I thought I should mention it.
     
    Tryz likes this.
  13. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    364
    I had not done that yet in this run. I had built everything manually and am now going back and rebuilding it programmatically. I am probably running into race conditions, getting things like the bones built first would definitely make sense.
    So much work, so little time...
     
  14. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    950
    I always use the Bone Builder to precreate the skeleton and save that in the character prefab. Prevents a lot of hassles later on. Doing this also lets you set up Mount Points at design time, the same way you would on any other character model.
     
    boysenberry likes this.
  15. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    950
    Just wanted to remind everyone that we do have an "unofficial" ootii Discord server. This forum is the primary support line, but we have sporadic discussions on the Discord.

    I'm already using Discord for other things, and I'm generally checking it many times throughout the day. If you need an answer from @Tryz directly, then email or this forum are the best options.
     
    boysenberry and Tryz like this.
  16. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    178
    Hey @Tryz , the issue that I am seeing is two fold. One if fired from the camera, the arrow goes way astray, and two, the default IK on the character, (Polytope Studio modular armor character) when firing the bow is way off when the angles are set to 0 and 0. I am using a value of approx 2.5 and 16.5 to get it close, i still need to dial it in.

    I could send you a stripped down project but I would really like to dig into the code and try to figure it out. I will probably show up again asking for hints at some point but for now, I can get it working just fine by dialing in the values.

    The only things I am wishing for now is a more advanced character wizard system that will allow me to preload more of the individual motion parameters. Something else to dive into myself.

    Anyway, no need to spend anymore time on it unless I reach out. Any chance you make it back in 2021 and continue developing packages?
     
  17. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    @KeithBrown , That's a great looking character set.

    For the arrow, it's probably something to do with the left & right hand bones. Firing from the camera being whacky just isn't right and I'll look at that.

    I'll be heading back in February. The park will open in February and things are going well. So, I've been getting back into Unity and the assets. I'll have more time for things beyond just support. :)
     
    TeagansDad and FargleBargle like this.
  18. ViVugameStudio

    ViVugameStudio

    Joined:
    Oct 5, 2016
    Posts:
    7
    Hi @Tryz ,
    I have setup motion controller for player and NPCs and it work well.
    The problem is I have a lot of cut scenes and want the player/NPCs play some animations ( with root motion) but the motion controller already take control of root motion so the cut scene animation not run correctly.
    Is there a way to let the motion controller not handle root motion while the cut scene playing and handle root motion again when the cut scene finished ?
     
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Your best bet is to just disable the AC and MC while you do your cut scene. When you reenable the AC and MC you can call AC.SetRotation and AC.SetPosition to get the character back where you want them.

    The other thing you can do is set AC.UseTransorm = true. That will allow the MC to animate, bit you can control the position and rotation. It really depends on how you are doing the cut scenes.

    I hope that helps.
     
  20. ViVugameStudio

    ViVugameStudio

    Joined:
    Oct 5, 2016
    Posts:
    7
    Thank @Tryz,
    It works now.
     
    Tryz likes this.
  21. dmarqs

    dmarqs

    Joined:
    Oct 16, 2013
    Posts:
    26
    Hi,

    I'm using Running Jump and looks like the player goes up and falls too slow. How can I speed this process, like using Mario physics? I tried to change gravity and mass in ActorController but it didn't work.
     
    Last edited: Jan 7, 2021
  22. dmarqs

    dmarqs

    Joined:
    Oct 16, 2013
    Posts:
    26
    Answering my own question: I had to give really big numbers for gravity and mass. It worked! =D


    Another question: I want to keep momentum when character is jumping. I added my own custom version of RunningJump+IdleJump Motions, but I would like to keep momentum from the WalkRunMotion. How can I do that? There is a way where I can have it centralized instead of inside the UpdateRootMotion?
     
    Tryz likes this.
  23. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    I do that in the Jump motion (Jump.cs) as well. You have a couple of options:

    1. In UpdateRootMotion(...) as you suggest. Changing the rVelocityDelta property will change the root-motion value for that frame.

    2. In Update(...) you can use "mMovement" to add additional movement for that frame.

    3. In Update(...) you can use "mVelocity" to add using a velocity value. This value is in meters per second and I'll apply the delta-time later.

    My Jump.cs uses mMovement & mVelocity to cover the momentum that is carried when the jump starts and to account for some offsets.

    I hope that helps.
     
  24. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    178
    After owning this asset for several years, I have finally attempted to get down into the nitty gritty of it and create my own motion pack for Kubold's Spear and Halberd Animset and to be honest it was quite frustrating. 100% of my frustration stemmed from the fact that I cannot follow directions very well nor can I stop myself from making stupid mistakes. So after about 8 hours of going thru the videos and scouring the documentation I can say that I am 90% done with adding the motions to the motion controller. I just need to add some more animation events to some attacks. (I did not use them all as there were so many.), I need to write some code to add the state machines if they don't exist, and then finally I need to figure out the Basic Dodge which is why I am writing this post. It was not in the documentation for the Sword and Shield pack but it has an added sub state machine from it. There are no inputs added to the project settings for it though it is shown in the Input section of the documentation.

    Have I made another error or is this just something that is not complete? I did see in the motion setup itself there is a section to assign a key to the motion but assigning a key (q) did not activate the motion. I currently have an issue with Unity where if Unity loses focus my input goes crazy and it makes troubleshooting via code difficult so I have not tracked down why it is working. @Tryz or @TeagansDad , do you have any insight?
     
  25. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    178
    I was able to get this working by adding an action alias to easy input for Q and "Dodge" and also add a setting to the input settings for Q and named it Dodge.

    This should probably be added as part of the motion controller install or part of the sword and shield install. Or its possible that I really screwed something up! In either case I got the spear and halberd animations working pretty good with the motion controller and now I am really happy.

    Here is a video of going thru most of the options. It does not show the dodge but it is working.

     
    Last edited: Jan 10, 2021
    Tryz and boysenberry like this.
  26. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    950
    @KeithBrown - I think that I have the Character Wizard adding the Q input for Dodge, if you're adding the Sword & Shield or Archery pack -- or any of my Kubold packs. I'll have to double check on that.

    I have a better version of Basic Dodge that I can send you. I reworked it so that you can exit the dodge early and have it transition fairly smoothly back into moving (I use an "ExitDodge" animation event). It didn't feel very fluid having to wait for the dodge animation to get back to the idle pose before moving again.
     
    Tryz likes this.
  27. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    178
    Sure, send it over and I will start using it!
     
  28. dmarqs

    dmarqs

    Joined:
    Oct 16, 2013
    Posts:
    26
    Hi again,

    Trick question: Is there anyway that I can use Motion Controller without ActorController? I would like to use another character controller that will fit best my needs for a more Mario game style, that has some out of the box controls.

    I really love how Motion Controller works, I just would like to use that animation controller layer above another character controller.

    And of course, everything related to updating movement, I'll do in the "Update ( float rDeltaTime, int rUpdateIndex )".

    And I will not use some stuff like UpdateRootMotion too of course.

    I mean, I'm not looking for a way to completely replace AC integration with MC, but use MC as an animation layer for other character controllers.

    Thanks! =D
     
  29. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    737
    I just noticed something weird when testing NPCs. If I set them up as combatants, and include a health attribute and an Actor Core with Damaged and Killed reactors, but no Motion Controller, they react immediately to being shot. When I add Motion Controller, they take a few seconds to notice I've killed them. Why is that? Here's an example:

     
  30. Jayiel

    Jayiel

    Joined:
    Nov 1, 2018
    Posts:
    2
    We have the Motion Controller, the other add on's as well as the Swimming add on. We followed the directions to use Maximo swim animations, but the Mixamo swim works as it should but is horrendous looking so we purchased this Animset Swimming Pack that looks Franky to be the BEST Swim Animation Pack Asset on the Unity Sore. https://assetstore.unity.com/packages/3d/animations/uss-animset-swimming-181530


    How do we go about swapping out the Mixamo Swim with some of these and also add in several of these new ones? Two of us search this forum as well as YouTube and have been looking through the ooTii Documentation and can not find out how to use Swim Animations that are not Mixamo. These are .anim from Umotion Pro and so we can convert them to .fbx if needed. Thanks and have owned the motion Controller for a long time, but always only used it as directed. Now we are working on a project heavily focused on kayaking / canoeing, swimming and aquatics so we need to use a wider array of animations and would prefer the Motion Controller over Game Creator's controller.

    Edit to ask if this is the video I should be looking at? Can it be used for directions for adding custom Swim Animations to the Swim Add On?
    Or is the Swim Add On interface just part of the MC interface and adding in any custom animations are done the same as in the video weather swimming, weapons attacks, or other?
     
    Last edited: Jan 16, 2021
  31. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    664

    They are just animations, so just swap them out with the ones you want. MC, is modular base asset, so its fairly easy to add your own, in that video is a good start. I use all custom animations... MIXAMO animations are terrible.. I know, Tim recommends them since they are free, and used to get folks rolling more or less. But, use your own for sure. or ones you bought else where.:) That video will get you started. You can add any motion you like with MC and the add ons, that is what is so great. I used it for the first time years ago... I been a programmer and never been a fan of third party assets for controllers, but I used MC, and stripped out everything to bare bones and was able to add everything custom. I ended up selling a game to an investor which ended up being added to the an app store, I also helped many clients over the years who had used MC, due to me recommending. Some used in games they where making...

    It was super easy, due to how modular MC really is...
     
    Jayiel and Tryz like this.
  32. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    178
    Basically what @Recon03 said, but if you find that just swapping out the animations does not work for you then in that case you might need to create a new motion based off of the swimming motion. This does require programming knowledge but this video should get you started.

     
  33. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Hey @dmarqs ,

    I'm afraid not... at least not without a fair amount of work. The MC was built around the AC and it leverages features like grounding, alignment, movement, etc. The information from the AC like ground distance, velocity, direction, etc. are used by the motions as well. So, there's a lot tied into it.
     
    TeagansDad likes this.
  34. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    @KeithBrown , That's pretty awesome. Your videos look great. Great job!

    You didn't do anything wrong. I couldn't find good animations for the dodge with a sword and I think I just backed-off of it.

    I like the way you changed the attack style with your component too. That gives you a ton of options... even for NPCs. Really nice! :D
     
  35. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Hey @FargleBargle ,

    I'm using my Shooter MP Demo scene and changed the "Enemy" health to 1. Then, when I shoot him he immediately reacts. So, I think that's all working right.

    The Basic Killed Reactor has a 3 second delay before it disables components when the MC exists. That allows the MC to play the death animations before the MC, animations, colliders, etc. are disabled.

    What I'm thinking is that your MC might not have the Basic Death motion added or an animation may not be set. So, you don't see the instant reaction. Instead, you just see the 3 second delay before all the colliders are disabled.

    Go to BasicKilledReactor.cs (line 204) and see if changing the 3.0f to 0.05f helps. If so, you probably want to check your Basic Death motion or create a custom "Killed Reactor" that doesn't do the delay. It depends on what kind for reaction you want your MC enabled NPCs to have.
     
    FargleBargle likes this.
  36. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    @Jayiel , What @Recon03 and @KeithBrown put above are exactly right.

    There's really three options to custom animations:

    1. Easy - Just replace my animations with yours
    This option works well if there's a one-for-one replacement and you don't have a lot of transitions. This works a lot of the times, but is a pretty basic approach. Fortunately, it's just standard Unity sub-state machine animation replacements.

    2. Moderate - You can expand on the animations by adding transitions
    Since everything is done within Unity Animator, you can replace animations and chain animations together to create transitions. This can be used to really get animations to look good. You would leverage Mecanim's standard states, transitions, and my Animator Parameters to have your state machine flow how you want.

    This is more complicated, but it's all done inside Unity's state machines using standard Unity workflow.

    Check out WalkRunPivot v2-SM and the states and flows as an example. It's a more complex state machine, but the transition from idle-to-walk really help with realism... if that's what you're going for.

    3. Moderate/Hard - Motion allow you to do anything
    Motions are a mix of Unity's animation state machine + code. That's what allows you to create your own action.

    If your swimming has advanced transitions or environmental interactions, you can create a motion that plays your animations in your state machines how you want.

    In this case, you'd create a custom "JayielSwim" motion to activate your animations using the flow the Motion Controller gives you. It is more complicated as you have to know how to code, but it gives you all the control.


    Check out the videos the guys posted and the Motion Builder's Guide. Those should help if you decide to go with #3.

    Also, feel free to email me for help.
     
  37. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    178
    So I have successfully integrated most of Kubolds motion packs with the motion controller (Thanks to TeagansDad for sharing some of the Kubold animation controllers), melee pack, archery pack, and spell pack and it is working nicely.

    It is currently using Ootii's Basic Inventory, Attack Profiles attached to the weapons, and colliders. I am currently switching over to Inventory Pro and it works better with want I want for my game. So that means that instead of equipping weapons thru 'inventory sets', I will equip the individual weapons with Inventory Pro with Attack Profiles attached to the individual weapons. So I have a sword that it using Kubolds Sword Animset Pro animations and the attack styles are attached to the prefab. I also have a shield with no attack styles as it does not apply. What is supposed to happen after I equip the shield with the same sword as above? The Sword Animset Pro animations no longer apply and it should instead be the Sword & Shield Animset Pro animations.

    Do i need to write code to switch the attack profile on the sword when the shield is equipped/unequipped and also check for a shield when the sword is equipped and choose the appropriate attack style then? I can create a new Basic Attack Profile that holds 2 separate attack profiles for with and without a shield being equipped and then hook into the appropriate events to modify the components. I think I will also have to modify the melee weapon form also to make sure that the correct animations are being used for equipping and unequipping, motion etc.

    Does this sound correct? Is this situation already addressed by the motion controller already and I am just missing it? Anyway, I do not think it is a difficult thing to code up, I just do not want to reinvent the wheel if it is already rolling down the road.
     
    Last edited: Jan 22, 2021
    Tryz, TeagansDad and boysenberry like this.
  38. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    950
    I have an "advanced" Inventory Pro integration that you might find useful. I wanted it to work like most 3rd person action/RPG games where "equipping" the item in the UI attaches it to your character model in the "stored" position until you draw the weapon via input. The "bridge" component is built on the logic of BasicInventory for animating drawing and storing weapons. Essentially what I do is to rebuild the Weapon Sets when a weapon is "equipped" in the Inventory Pro UI.

    I'll send you a link via PM. I haven't touched it in over a year, I haven't tested it with the current version of the ootii assets, and it's currently using an underdeveloped simple equipment mounting system that I put together. It needs proper support for Mount Points -- I whipped up a simple alternative mounting system just so that I had something that I could share freely. If anyone else wants the link, just PM me.

    The current Basic Inventory system wasn't really designed to handle that sort of situation. I did built the Attack Profile feature with the idea that at some point I'd come up with a method of switching the active Attack Profile when changing the stance or grip of the weapon (which would include equipping or storing the shield).

    I've done preliminary work on an enhanced inventory/equipment system, but nothing substantial enough to share. The core design is moving all of the item properties to ItemDefinition (Scriptable Object) assets. These properties would also include "states" to handle the different stances in the animation set, multiple animation sets for a single item, camera motor changes, etc. Plus defining the conditions that activate that "state." I never got too far with the states and conditions. ;)

    When using Kubold's packs, the setup for a one-handed sword could potentially get quite complex:
    • wielded one-handed in the "fencing" style stance in Sword Animset Pro
    • wielded with a shield in Sword & Shield Animset Pro
    • wielded two-handed in Longsword Animset Pro, which has both right-foot-forward and left-foot-forward stances
    • wielding one-handed while casting a spell with the off-hand (Riko's Mage Staff Animset Pro has some left-hand casting animations that I think could blend well with the Longsword or Sword & Shield poses)
    Spear & Halberd Animset Pro has two different stances (spear raised or at waist-level), each with their own walk/run, attack, block, dodge, damage reactions, etc.

    I figure if I can make it handle all of the one-handed-sword variants, then that should cover the vast majority of cases.

    Personally, I'd be inclined to use the Longsword Animset Pro animations when the shield is removed. The stances are virtually identical, other than the arms, so they blend easily. There isn't any transition animation between the Sword & Shield stance and the Sword stance, and blending looks weird because of how different the stances are. Also, if you're not using a shield, then wielding the sword with both hands gives you more speed, power, and control.

    Yes. For now, this is the way to handle it. As I mentioned above, the preferred way to manage this would be to make it all data-driven and define these conditions in Scriptable Objects.

    After months of feeling severely unmotivated to resume work on these various enhancements (I blame the COVID situation), I'm finally starting to feel a spark of interest again. Not going to promise anything of course. :cool:
     
    Tryz likes this.
  39. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    @KeithBrown ,

    That's awesome. Congrats on getting all of that working. Having been through it, feel free to PM me any thoughts on how I can make the process easier!

    My thinking with going from "sword & shield" to "just sword" or "two swords" was that these are two different Weapon Sets. In my approach, the different Weapon Sets changes the "Form". That would have you walk differently with sword & shield vs just sword. When attacking, you'd use code to change the "Attack Style" like this:

    Controlling The Attack Style With A Reactor

    If you're wanting to leverage the attack profiles, you would do it exactly like you describe. Than you have a different set of styles to choose from, but you'd still choose which style using the link above.
     
  40. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    I totally understand. It's been a crazy time all around.

    I hope you (and everyone) is staying healthy, safe, and sane. :)
     
  41. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    ootii Asset Notice:

    To match with the message Unity sent out last month, I'll be updating all my assets to support a minimum:
    Unity 2019.4 LTS

    As announced by Unity, starting in June new assets can only be submitted using Unity 2019.4 LTS or higher. While assets can be updated using Unity 2018.4 or higher, I think it makes sense to move everything to Unity 2019.4 LTS.

    As Unity moves forward, I need to be able to count on new features as well.

    If you use an earlier version of Unity, please back up your ootii packages.

    I'll plan to do this mid-February.

    Thanks for understanding,
    Tim
     
    Last edited: Feb 1, 2021
  42. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    97
    Hello,
    So I have a problem with OnAnimationEvent firing on animation. And I debugged and this is what happens.
    In Motion Controller script the hashes don't match and my event does not fire. what could cause this?

    upload_2021-1-30_2-34-41.png
     
  43. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    664

    I understand for you and Unity doing this. But lets hope, Unity gets there act in gear, some games/devs/teams have to use older version due to old bugs never being fixed. ( if Unity gave source it would be a non issue) . Of course not your fault.. Just saying for the years I been here, Unity tends to get on my nerves for them pulling this. Unreal, I use ONE VERSION. and only need one version, Unity I always had to use LTS versions, but stuck for some clients using older versions.. ( lucky i'm retired but I feel for the people who have been stuck in that trap. Even to this day I have to use older API, for Unity lack of understanding what is needed for actually game devs. I feel bad for you asset devs since as it is there are to many damn versions...to support... It should be ONE. Not 10 or so..versions. So lets hope they are finally doing something about it..... In my opinion, asset devs should have to worry about LTS versions, NOT BETA crap. Just my opinion.

    This LTS, Beta, Alpha, HDRP, URP, Built in, is crazy.... They should have PC , Console'Mobile. HDRP, URP, that is it. and it should be working.... . every other game engine I ever used, I never seen such nonsense before..... and I used over 30+ game engines in my career, so annoying ....so I feel for you TIM as an asset dev, most people don't understand the hell you guys go through. So I support you doing this, and thanks for the heads up.

    PS: I sold a moble game, that uses MC, a few years back and they had to buy it, of course when I sold it, so they use 2017- 2018, or older, so I will point them here as well.

    I don't talk to them much anymore, but incase they don't know.
     
    Last edited: Jan 30, 2021
  44. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Haha... I totally understand the venting.

    I was trying to support Unity 5, Unity 2017, Unity 2018, Unity 2019, and Unity 2020 for all the different builds you mention above and it just wasn't possible. So, I'm trying to stick with the last two main versions (in this case 2019, 2020.
     
    Recon03 and TeagansDad like this.
  45. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Hey @Hellwaiker ,

    What I'm trying to make sure is that the animator state that fired the event is still the animator state that we're in. This way if the event is delayed for some reason, the event still makes sense to fire.

    I don't remember why I had to do this and if the check is really necessary or just a precaution.

    On the yellow line you highlight (line 2497), the "_AnimatorStateID" is set during the MotionControllerLayers.UpdateMotions(...) call. Typically this is at the start of the frame.

    What it means in that your event is coming for the state after the animator has left the state (or possibly before I'm told we are entering the state).

    Is your event at the very start of the animation or at the very end? I'm curious what your setup looks like.

    First, you can comment out that condition and see if you get any odd behaviors. If you want to email tim@ootii.com and share info about your project setup, maybe we can zero in on why the states aren't the same that frame.
     
    TeagansDad likes this.
  46. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    97
    Hello, after working it further what was happening is that for some reason unity was stuck in the transition state. The transition line was blue while my event fired. Even though I had 0, 0 in exit time and the other thing.

    I ended up making a longer idle section before my animated action and this way I avoided the problem.
    I'm beginning to really hate animator as a system.
     
    Tryz likes this.
  47. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    I found with tiny animations (poses), you have to have several frames or Unity can do some odd things. Mecanim isn't bad, but like every system you have to learn its quirks.
     
    TeagansDad and Hellwaiker like this.
  48. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    664
    ya I bet you scream as well, having to support all that trash, it just never made any sense to me . I spent nearly 3 decades using various engines and never seen anything like that, what a headache for game devs, asset devs, the difference is we can say screw it. You guys, though.. boy, I always felt bad for you guys. . Smart move with the two versions and I understand. I have told some other asset devs, that users expect them to support a million versions to not do it, because I see it putting a strain in actually development... and its not really fair to the developer of the asset or others. Users need to learn how to take care of things them selves.....in my opinion...

    I just wish Unity would get there act in gear..... I know a few released games in 2018. ( not that you need to wait on them or anything but Unity sometimes, can make me bash my head on my desk. lol. and people always asked me, "RECON" why won't you sell your work, HAHA, no thanks, not after what I see some of you folks go through, I have enough crap with clients in and out of Unity to deal with. That is enough lol...
    anyways nice to see you Tim. Be well.
     
    Tryz and TeagansDad like this.
  49. antsonthetree

    antsonthetree

    Joined:
    May 15, 2015
    Posts:
    95
    Hello - I just downloaded the new version and imported into a new project with the latest 2019 LTS. I am having the following problems:

    In the _QuickStart scene nothing works. It's camera and keyboard are entirely unresponsive.
    In the demo_Interacting scene nothing is interactible. The door and box highlight yellow but the F key does nothing.
    In all demo scenes with a Shift = Run prompt, the shift does not cause any running.

    Thanks
     
  50. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    178
    Did you make sure to setup the layers and setup the input entries? Here is a link to the quick start guide. https://ootii.com/Unity/MotionController/MC2Guide.pdf

    I have installed the latest version in to a new project recently and had no issues. I will say however that I did not use the quick start scene but always start with a fresh one.
     
    Tryz likes this.
unityunity