Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Motion Controller

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

  1. indra-p

    indra-p

    Joined:
    Mar 12, 2013
    Posts:
    38
    This is the first time i tried to build the game since i purchased this asset like 3 days ago.. I also tried to build the game in a fresh project only with this motion controller installed. Same problem.
     
  2. Yerkisk

    Yerkisk

    Joined:
    Jul 28, 2015
    Posts:
    38
    Based on the post I've made with code 3-4 posts prior to this one, pretty sure this is an error with the framework.

    After more testing, it would appear that if you're not using the auto-generated code to create looped actions, the auto clear doesn't reset the phase to 0 after the Any State transition is completed, meaning that it will return to it after getting into the Loop phase of spellcasting. Using the auto generated code has fixed it. It may likely be that the Start or Loop animations or transitions are done too fast for the system to register when not using the auto-generated code.
     
  3. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    @indra-p I'll grab the latest Asset Store version today and have a look.

    I've been off work for a few months on medical leave and thus not at a computer every day. I do have a PC at home, of course, but I somehow didn't end up having much time to spend on the computer doing Unity stuff. Taking the kids to and from school, home renovations, Christmas, etc. I figured that I'd have more time than before to help @Tryz with support, but I was mistaken. :)


    I'm back at work today and once I get caught up on what I've missed whole I was away, I should be back to more regular activity here (I have Unity installed at work so I can use it on my lunch break or if I just need a short change of pace from my regular programming work).

    Tim just pushed out an update that I had been working on for a while... I thought we tested it thoroughly enough, but I could have missed something. If I don't get a chance to have a look while I'm at work, I'll do it at home after O get the kids to bed.

    @Yerkisk - I'm a bit rusty on how all of that works at the moment. If @Tryz is unavailable at the moment, I'll refresh my memory on it tonight or tomorrow and hopefully give you a satisfactory answer.
     
    hopeful likes this.
  4. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    @indra-p

    Are you just using Motion Controller, or do you have other ootii products installed? Can you check that you have the version of Motion Controller that was released on January 4?

    The line numbers in SerializationHelper.cs in the error log that you posted don't match the current version of the file. When I download and import the latest version from the Asset Store, everything works fine for me.

    Also, which version of Unity are you using?
     
  5. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    Sorry for the delay in answering your questions.

    You shouldn't need to use the auto-generated code for this; that's just a utility to create all of the boilerplate code needed to precisely monitor animator states and transitions. The "Basic X" set of motions have moved away from that paradigm and don't use any auto-generated code.

    I don't see anything that immediately jumps out as causing it to go back to the AnyState -> Start transition when the animation ends. However, there are two things that I noticed in your post on the previous page:

    In your animator controller, the transition from Loop to End has the condition L0MotionPhase > 4205. This should be equals, as there are motions which use Phase ID values greater than 4205 and you will end up with a conflict when such a motion activates.

    In FinishCasting(), you should be activating the motion phase with the auto-clear parameter set to true:

    Code (CSharp):
    1. mMotionController.SetAnimatorMotionPhase(mMotionLayer.AnimatorLayerIndex, PHASE_END, mParameter, [B]true[/B]);
    Most of the time, we're using the LxMotionPhase parameter in a way similar to the animator controller trigger parameter type, which is essentially a boolean value that gets cleared as soon as it is evaluated as true. Rather than having a trigger parameter and a bunch of other conditions in the animator, we're just using integer values specified by individual motions. So the majority of the time, you should be allowing SetAnimatorMotionPhase to auto-clear the phase ID when you call it. For more complex animation flows, you may want to manage the phase ID manually.

    When you call FinishCasting(), it sets the L0MotionPhase to 4205 and leaves it at that value, which shouldn't cause the AnyState -> Start transition to activate... but hey, Unity does some weird stuff sometimes. Try setting it to auto-clear and see if this still happens.

    Could you post the auto-generated code that you used to fix the problem?

    If it's still not working correctly -- or working the way you think it should -- please zip up a small project and send me a link to download it via PM and I'll have a look at it for you.
     
  6. indra-p

    indra-p

    Joined:
    Mar 12, 2013
    Posts:
    38
    Oh...Its looks like i miss the latest update.. i just update it today.. now i can build... its interesting i purchased the asset just a few hours before the latest update uploaded..
    anyway i still need the kubold MAP addons.. i wish you have time to work on that..
     
    hopeful likes this.
  7. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    Whew! Glad it's resolved for you!

    Working on it right now, actually... Thankfully, there isn't too much for me to have to update. Just want to ensure that it all still works properly.
     
    hopeful likes this.
  8. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    @indra-p and anyone else who has been waiting for me to post the updated Motion Pack files for Kubold's animations:

    Sorry about the wait. :cool:

    Kubold Motion Packs Jan 6, 2020

    The linked .unitypackage contains the Motion Pack setup files for:
    1. Movement Animset Pro
    2. Female Movement Animset Pro
    3. Sword Animset Pro
    4. Sword and Shield Animset Pro
    5. Longsword Animset Pro
    6. Two-Handed Sword Animset Pro (from Riko)
    It's too tedious and error-prone a process for me to export each set of files individually every time I update them (I keep missing something), so I will simply be including all of them in one package. Delete the ones you don't need (or leave them there -- they don't hurt anything); just make sure that you remove the corresponding Editor folder(s) as well:

    upload_2020-1-6_16-4-37.png

    Just as with the official Motion Packs, there is an "Extras" folder under each pack which contains a zip file of all of the .meta files for the animations. After you import the Kubold animations, overwrite the .meta files with the ones from the corresponding Motion Pack.

    There is a readme.txt and a demo scene for each package. Hopefully the demo scenes all still work properly. :)
     

    Attached Files:

  9. Yerkisk

    Yerkisk

    Joined:
    Jul 28, 2015
    Posts:
    38
    Thanks for the answer. I did actually catch the L0MotionPhase being greater instead of equal as soon as I fixed the looping issue. As for the auto-clear, I'll set it to true, but so far I've not encountered any issues by leaving it to false in that specific case (actually, it's also set to false when you look at the PHASE_CONTINUE of the BasicSpellCasting). The motion exits when it reaches the Idle at the end tagged as Exit, and the next activate simply resets the phase to start.

    As for the auto-generated code, I didn't modify any of it. I simply clicked on the generate button and pasted the code in the class, and that fixed the Loop returning to the Any-State transition. The code that actually auto-clear the phase is split into an if-else in the MotionController.cs class depending on if you're using auto-generated code or not :

    Code (CSharp):
    1. // If we don't have auto generated code, we'll look to see if the transition is different
    2.                     // from when we started. We can also see if the state itself has changed.
    3.                     if (lActiveMotion != null && !lActiveMotion.HasAutoGeneratedCode && !lActiveMotion.VerifyTransition)
    4. {
    5. ...
    6. }
    So my guess is that somewhere in that OnControllerLateUpdate method of MotionController.cs there's some difference if you're using or not auto-generated code that might fail. As the Start, Loop and End animations are only 10 frames long (30fps), it might be due to the code running after we're past the first state due to slowness of the editor in playmode. I believe the phase is reset only when leaving or being in a state that has a transition from Any-State.

    But for now everything is working using the auto-generated code, so it's really up to you to decide if you want to investigate any further or not. Might be worth investigating just in case anyone else face the same type of issues.
     
  10. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    I suspect that you're right about this. I'll look I to it further, even if it's only so that I can be certain as to what is going on. It's the finer details later me this that I have trouble remembering when I've been away from Unity development for a little while.
     
  11. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    I would also like to invite everyone to join us on our unofficial Discord server. It's not super active right now, but I check it quite regularly and it's a good place to chat with me in real time.
     
    Subliminum and lolaswift like this.
  12. lolaswift

    lolaswift

    Joined:
    Jan 10, 2019
    Posts:
    151
    You're awesome!!
    Many thx!
     
    TeagansDad likes this.
  13. indra-p

    indra-p

    Joined:
    Mar 12, 2013
    Posts:
    38
    thanks you.. i just tried it.. i found some issues..
    1. the only motion that works is the "basic idle" and "basic walk run pivot"(the version that doesn't have any start/stop animations) and when i tried to activate the "idle" and "walk run pivot"(the version that supposed to have start/stop animations) the character just doesnt move at all..
    2. holding run key(Shift) doesnt work. the character can only walk..
    3. walk run strafe also doesnt work.


    this is how i installed it : install.png
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      50 KB
      Views:
      453
    Last edited: Jan 7, 2020
  14. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    @indra-p - The new version only uses the Basic Idle, Basic WalkRunPivot, and Basic WalkRunStrafe motions.

    Because animation sets are very inconsistent as to what they include in terms of start, stop, turn, etc animations, it's very difficult to use the same underlying logic across multiple animation sets the way that the Basic motions do.

    I once had written full WalkRunPivot and WalkRunStrafe motions that included start/stop, 180 degree turns, etc for most of the animation sets that are supported in my new version. They were incredibly tedious to develop. And because there was a ton of copy and pasted code across each type of motion, they were a nightmare to maintain.

    I apologize if that's what you thought you were getting with these. I've thought about adding support for start and stop animations, but I don't have any concrete plans for that yet (and there are a lot of features band improvements that I plan to tackle first).

    The Idle, Walk Run Pivot, and Walk Run Strafe motions included with Motion Controller do not support different animations unless you manually modify the animator controller. In that case, you'd need to replace each animation in a state by hand and tweak all of the transitions so that it looks good.

    My old MAP pack on the Motion Vault is essentially the Idle and WalkRunPivot_v2 motions with different phase IDs, reassigned animations, and tweaked transitions
     
  15. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    191
    @TeagansDad Whats the best way to download. I keep getting the.gz and.tar files when i hit the download button on your google drive
     
  16. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    What's inside the .gz and .tar files? When I click the button, I get the .unitypackage file.

    Actually, this sounds vaguely familiar... Which browser and OS do you use?
     
  17. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    191
    I use chrome which in theory I would think would be the best. However, i do have some addons for chrome one of which deals with downloads which might be interfering. I switched to Edge and in this case it worked fine. Thanks for pushing me in the right direction to switch browsers.
     
  18. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    No problem!

    I'm guessing that it must have been an extension, as I use Chrome and the download link works normally for me.
     
  19. indra-p

    indra-p

    Joined:
    Mar 12, 2013
    Posts:
    38
    Well..that disapointing..the transition movement is the main reason i purchased this asset... so now what i can do to get a properly working motion system with that feature? I dont mind paying extra..
     
  20. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    @indra-p - Should I assume that you're not a coder? ;)

    When I have a chance, I'll download my old MAP motion pack and try to get it working with the current Motion Controller version. If it doesn't take me too much time, I'll get it fixed up and release the updated version.

    That just gives you the unarmed (male) movement motions, but it has all of the transition animations. If you want the same type of movement for various weapon animation sets and the like then you'll need more custom motions.
     
  21. indra-p

    indra-p

    Joined:
    Mar 12, 2013
    Posts:
    38
    Yes..im not a coder.. im just a 3d artist wanting to see my character models walking around in game nicely...not really making any actual games yet.. but i have plan.

    Thats good to hear..its okay if it only work with unarmed movement since i only have those.
     
  22. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    Just looking for a quick show of hands here... is anybody NOT using the .NET 4 Equivalent Scripting Runtime Version?

    The .NET 4 Equivalent became the default scripting runtime version with Unity 2018.2, and it was moved out of "experimental" status with Unity 2018.1.

    The older .NET 3.5 Equivalent Scripting Runtime Version was deprecated in Unity 2018.3 and 2018.4 LTS, and is no longer an option for Unity 2019.1 and later.

    I think that Unity 2017.4 LTS might have the "stable" .NET 4 Equivalent, but I'm not totally sure about that.

    So basically, is anybody still using Unity 2017.4, 2018.1, or 2018.2?
     
  23. greatowq01

    greatowq01

    Joined:
    Dec 16, 2018
    Posts:
    37
    Hello,
    I want to create some physically-simulated fighting systems, it seems that RootMotion's PuppetMaster package works well for that. But i prefer OOTII MotionController and am't sure that PuppetMaster is compatible with it. It looks like the OOTII Bone Controller is the same kind of tool as PuppetMaster and i want to do my job with BC, however it seems that it's not an easy job. Would anybody like to help and share some experience?
     
  24. greatowq01

    greatowq01

    Joined:
    Dec 16, 2018
    Posts:
    37
    I try to build my physically-simulated fighting system by using BC ImpactMotor, but some unnatural distortions of the Character happen when there is an impact...the chest of the character becomes concave. I just want it react like rigidbody driven by joint.How do you guys deal with this issue?
     
  25. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    PuppetMaster is probably more what you're looking for. Bone Controller is closer to RootMotion's Final IK in terms of functionality. I don't think that the Impact Motor will really going to give you the effect that you're looking for.

    PuppetMaster is compatible with Motion Controller, and does include an integration package -- but the demo scene is broken, as it is missing references to the player prefab. I think some asset GUIDs changed on some of the Motion Controller demo assets since the version that this integration was created with (2.73).

    I don't have a lot of experience with it, as PuppetMaster is a fairly complex beast on its own. I'll see if I can get the integration demo scene working again though, but I may have to set it up from scratch.
     
    Last edited: Jan 10, 2020
  26. indra-p

    indra-p

    Joined:
    Mar 12, 2013
    Posts:
    38
    @TeagansDad i just tried again the kubold MAP addons from ootii's vault. its actually work now..it doesnt work in the frst time i tried because i didnt update the motion controller..

    anyway i have another question, i just tried the Footstep addons from ootii's vault. to make the footstep sounds. i installed it, and its actually work but only with walking animation, when its running it doesnt make any sounds. why did that happen?
     
  27. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    @indra-p Glad it's working for you now.

    I haven't used the Footsteps add-on, so I don't know why it doesn't make sounds when running. It's a user-contributed script. @FargleBargle wrote that one. Hopefully he'll drop in and answer. :cool:
     
  28. PesadeloDoEspantalho

    PesadeloDoEspantalho

    Joined:
    May 26, 2017
    Posts:
    45
    Hi, how are you?
    Are your Assets still compatible with UNet??
    You did a #if or you are removed, so that I can be sure???

    https://ootiigames.com/?p=1102

     
    Last edited: Jan 12, 2020
  29. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    772
    As the guy who originally wrote it, I'd say because it's old, and was always a bit buggy. It was more of an experiment than anything else, to show one possible approach to making footstep sounds. The code is fairly basic, but may not be robust enough for an actual game without additional work. I had problems with it double triggering, or sometimes not triggering at all, and think it might be frame-rate or CPU load sensitive. This might explain why it works better for you when walking than running. I've been wanting to take another crack at it, but never seem to find the time.

    Since it uses raycasts to detect foot impacts, it could also depend on the terrain you're walking on, so adjusting the Range values may improve your results. Another way would be to only use raycasts for surface material detection, and trigger the sounds using the animation cycles instead. As long as the character is grounded, you could set it to generate a footstep sound whenever the animation cycle places his foot on the ground.
     
    indra-p and TeagansDad like this.
  30. indra-p

    indra-p

    Joined:
    Mar 12, 2013
    Posts:
    38
    thanks for the reply.. i figured out how to fix it. i just move the prefabs slightly back from the default position, about 0.2... its work perfectly now...
     
    FargleBargle likes this.
  31. greatowq01

    greatowq01

    Joined:
    Dec 16, 2018
    Posts:
    37
    Thanks for your help.
     
  32. greatowq01

    greatowq01

    Joined:
    Dec 16, 2018
    Posts:
    37
    Sword&Shield Bug01.gif
    I found a bug in the demo of Sword&shield.I duplicated several enemy-instances in the hierarchy,then ran the demo.As you can see above, these NPCs crowd together and hurt eachother.@Tryz@TeagansDad
     
  33. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    @greatowq01 - I wouldn't really classify that as a bug; it's just something that the demo was never intended to handle.

    The NPC has a script with extremely basic AI: essentially, just move towards the target and attack. It doesn't even use pathfinding, so if you put a wall between the NPC and the player, the NPC would get stuck on the wall, trying to walk through it.

    Avoidance and flocking behaviours are topics for dedicated AI solutions. If we rework the demo to use a NavmeshAgent on each NPC, then we would see some avoidance behaviour, but they're still likely to end up bunched up around the player without additional rules for giving way to one another, maintaining minimum distance, etc.

    The demo could definitely use some more polish, but it was never intended to be more than a simple example of using the motion pack on a player and NPC.
     
    Tryz and Subliminum like this.
  34. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    97
    Hit me up on Discord if you want some AI advice :)
     
    Tryz likes this.
  35. Tiuri

    Tiuri

    Joined:
    Apr 5, 2019
    Posts:
    6
    Hi,

    I own the shield and sword motion controller and I wanted to create chain attacks. Unfortunatley I can just create two attacks in a row, but not more. I would like to have a three or four chain attack. I assume that the procedure to create three in a row chain attack is the same as a two in a row. So L0MotionPhase is equal to 3201 and the L0MotionForm is equal to the form that defines the new created attack. I also did set the "Next Attack Style" in the inspector of the motion controller, but I am still just able to do a two in a row chain attack instead of three in a row.
    I hope that somebody can help me and I appreciate it very much

    Thank you and have a nice weekend :)
     
  36. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    @Tiuri - if you download my set of motion packs for Kubold's animations, you can see how I've set up 3-attack combos for all of the weapon types included. I posted it on Jan 6.

    Don't worry if you don't have the animations. There is a demo scene for each animation set and you can look at the animator controller and the Attack Profiles defined for each weapon.

    If you're not familiar with Attack Profiles, it's just an alternative to setting up Attack Styles on the Basic Melee Attack motion itself. Attack Profiles are ScriptableObjects and are saved as assets, so you can re-use them instead of recreating the same settings on every character.
     
  37. Tiuri

    Tiuri

    Joined:
    Apr 5, 2019
    Posts:
    6
    That's great, I will look it up right now. Thank you very much for your fast answer. ;)
     
  38. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    KeithBrown, Subliminum and TeagansDad like this.
  39. fenkan

    fenkan

    Joined:
    Jan 20, 2020
    Posts:
    1
    Is there any guide on how to properly rig a character for use with the motion controller and animations? For example do I have to stick to a naming convention on the joints/bones?

    I'm pretty new to unity so let me know if I'm confused here, but the character is supposed to get a set of default animations right?

    It would also be amazing with a guide on how to add custom animations.
     
  40. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    97
    https://docs.unity3d.com/Manual/UsingHumanoidChars.html

    That should cover Rigging from a Unity perspective, however it is usually done in a 3D modelling program i think it is possible through Unity now (somehow haha)



    And this will explain Custom Animations. The videos on the Ootii Youtube channel are definately worth checking out if you haven't already.

    Also here is a link to the Ootii Discord Channel where you will likely get faster answers to any further questions. :)

    https://discord.gg/brqSSsb
     
  41. WILEz1975

    WILEz1975

    Joined:
    Mar 23, 2013
    Posts:
    372
    Hi, I have a question, it hasn't already been asked.
    My animations have no movement and I have to manage it by code.
    Is there an option to manage "in place" animations that don't have motion in the animation?
    Or should I use this method?
     
  42. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    The included walk/run motions(BasicWalkRunStrafe and BasicWalkRunPivot) will work with animations that don't use root motion. Both motions expose Walk Speed and Run Speed fields where you can set the actual movement speed. There are other included motions that manage the character's movement in code, rather than using root motion.
     
  43. WILEz1975

    WILEz1975

    Joined:
    Mar 23, 2013
    Posts:
    372
    I do not understand. Do I still need to create the motion script myself (using exposed parameter) or is there an option in the controller?
     
  44. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    It's an option on the included Motions that control movement:

    upload_2020-2-5_15-15-33.png

    If Walk Speed and Run Speed are set to 0, the character's speed will be controlled by the root motion data in the animations. If you're not using root motion, then you just need to set the speed values manually.
     
    WILEz1975 and hopeful like this.
  45. WILEz1975

    WILEz1975

    Joined:
    Mar 23, 2013
    Posts:
    372
    Thanks TeagansDad, I understand, it works.:)

    Since I have now disturbed ...
    Can I manage the Animator InputMagnitudeAvg parameter?
    My game is an arcade and the movements are quite "abrupt". When the character stops it continues to move for a few milliseconds, even if I set the Smoothing Samples to 0. It is not a problem of animation but of movement. I think it's the InputMagnitudeAvg parameter:
     
  46. WILEz1975

    WILEz1975

    Joined:
    Mar 23, 2013
    Posts:
    372
    Isn't there an IK system?
    I think I will make myself the controller that I do first. :(
     
  47. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    429
    Great tool, any variables to control leaning when turning corners etc? As is, the motion appears rather static unfortunately. This dynamic component is really important.
     
  48. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    There is a motion named WalkRunTwitch that may have a responsiveness more to your liking. It doesn't support multiple animation sets (by varying the Motion Form) like BasicWalkRunPivot does, but give it a try and look at the code to see how it works internally.

    There's no built-in IK system, as least not as far as a Ground IK goes. You can use Final IK for that, or ootii's Bone Controller (add a Foot to Ground Motor to each foot). Any grounder IK solution should work fine.
     
  49. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    None of the built-in motions control leaning while turning. I think this is mostly because there weren't any such animations to match the freely distributable walk and run animations included with the controller. It would likely be fairly straightforward to create a new motion inheriting from BasicWalkRunPivot or BasicWalkRunStrafe and set the necessary animator parameters from there.
     
  50. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    429
    It's the only thing stopping me making a purchase at the moment. :( Other than that, it looks fantastic and I can see how this would facilitate my workflow.