Search Unity

Motion Controller

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

  1. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    I don't know if this is the place to report issues with an add-on pack but I'm seeing something with the Shooter Controller; I apologize for not having a screenshot or video, its been difficult to capture. It is easy to reproduce. If one is on the standard Shooter demo scene and tries to Right-Click to aim and then performs a Jump, the entire upper body immediately skews to the right throughout the jump. This can be best seen with the pistol. I haven't yet looked into it and don't know if it's a conflict between the Locomotion & Shooter controllers.
    Any ideas. I may just disable aiming while jumping since it's sort of an unnatural thing to do anyway.
     
  2. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Sorry, read the instruction manual - Gun IK. Whoopso_O
     
  3. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    That's true, but I think there may be an issue still...

    Posting here or emailing tim@ootii.com is fine.

    You're right. I was able to reproduce this.

    In my case, it turned out that my Pistol Aim Idle Pose animation was missing. So, the arms in the jump motion were not being overwritten. Can you check yours?



    In my case, there was no animation ("Motion"). So, I had to find the "PistolIdlePose" and put it in. Then, it didn't go whacky.
     
  4. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    @Tryz Yeah, mine is empty too.
     
  5. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Good to know. I'll fix that in the next push. For now, you can set it manually from the animations in the shooter motion pack's animation folder you initially setup.
     
    hopeful likes this.
  6. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Also, should Gun Control (I think that's what it's called) be added to the player when he is setup as a Shooter. I didn't notice it until I read your instructions a little more thoroughly.
     
  7. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I think you mean the "Gun Core".

    No, that would be on the gun itself as it controls how the gun shoots and the different components (magazine, scope, muzzle, etc).
     
  8. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Thanks.
     
  9. NinjaProgrammer007

    NinjaProgrammer007

    Joined:
    Mar 24, 2017
    Posts:
    2
    Is there anyway that I could use the actor controller's wall walk mechanic on a different character controller that I made?
     
  10. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Yes. If your character controller doesn't actually move the character, but instead it tells the Actor Controller to move. This is exactly what I do with the Motion Controller.

    In this case, your character controller (and my Motion Controller) are what I call "drivers". They tell the Actor Controller what to do and the Actor Controller handles movement, rotation, wall walking, etc.

    See the documentation (page 3):
    http://www.ootii.com/Unity/ActorController/ACGuide.pdf
     
    hopeful likes this.
  11. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    Do you have a guide with "Mixamo’s Free Animation" import for default behaviours for a humanoid ? Or at least tell me what to change in the guide you made for the shooter import.
    I tried change some clips in walk-run-pivot-v2-sm where i see is the moving / i also tried to disable some paths so it focuses only on basic walk and read a lot in your guides but is not enough it seems.
    My problems are those:
    1. my character is sliding a bit even on idle
    2. my character walks with the clip motion and then walk animation stops and it just slides

    thank you for your time and you awesome product!
     
  12. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hi @VP_3 ,

    I don't have a guide for changing out my default animations like Basic Idle or Basic Walk Run Pivot. In cases like that, it's just a matter of replacing the animations inside the sub-state machines.

    The trick is just to make sure the animations you are replacing fit together (ie make sure they transition on the same foot, etc).

    Unfortunately, you started with one of the more complex sub-state machines.

    You definitely don't want to disable transitions (paths) or you'll find the whole thing doesn't work and you'll get odd behavior. My motions (the code) are built to work with the states and transitions I created.

    I'd suggest start with a simpler motion like Basic Walk Run Pivot. In this case, you're just replacing 3 animations:



    When you replace animations, you may need to change transitions based on your animation lengths. This would be standard Unity animator work. So, there's tons of videos that show how to change animations, transition settings, etc.

    Since this doesn't happen with my default, I'm assuming it's because you modified the sub-state machine flow. While you can simply replace animations, you can't modify the flow without modifying my code. The two go hand-in-hand.
     
  13. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    i will learn more advanced stuff of course but in the meantime i just want to have some simple motions.
    i imported ur twitch motion and it seems to me it appeeared now in the humanoid

    upload_2018-5-23_15-22-7.png

    what i dont understand is how do i say the character to use this ?
    in Player > Custom Script ? or is it another place ?

    also, if i use the shooter mixamo tutorial but i dont have a shooter but a simple character atm will it work ?
    maybe ill add guns and other stuff later but the basic moves will work ?

    and finaly is there a tutuorial for animals movement ? i am very interested to anymate a cat with MC :)
     
  14. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    i found the answer to the use of twitch :)

    i must delete the pivot and add the twitch and then work on that

    should i delete the idle and the fall too ? or no need ?

    animation is better now, i will see if there are more issues
     

    Attached Files:

  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Correct. That's the way the motions work. You'll add the ones you want to use and remove the ones you don't.

    Definitely keep an idle. That's the default motion when nothing else activates. But, you can choose "Basic Idle" or "Idle". I'd default to "Basic Idle".

    Definitely check out the documentation and videos. That will help.
    http://www.ootii.com/Unity/MotionController/MC2Guide.pdf



    Check out the Ripper video:
     
  16. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    i watched the worg and helped me achieve this and helped (i didnt have a pose i the walking video)

    upload_2018-5-23_16-28-33.png

    the problem is that when looping it push the character back
    also i still have a bit of sliding effect on the character when standing still too -- my idle clip is 0.1 like in your examples

    should i set up something more here but the 2 ?
    it seems to me the transitions are done correct and there are other settings i should take care of
    i use AC and i made a component with the script the developer says and i don't find anything else to set up to still the character

    upload_2018-5-23_16-27-57.png
     
  17. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    for other who might read: the sliding is unity stuff and it has many posibilities to solve: any of kinematic check or increase Drag solved it

    i still have a problem with the position pf the character after the loop is ended --- maybe anyone has some info on this

    LE: solved that too: checked the loop pose on the walk clip in the picture above and now it works flawlesy ( I hope my struggle will help some beginners :p )
     
    Last edited: May 23, 2018
    hopeful and Tryz like this.
  18. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    No doubt.

    The MC makes heavy use of Unity's animations and animator. So, understanding the properties on the animations and how the animator flows work is important if you're customizing them.

    The learning never ends. :)
     
  19. aLeXmOrA

    aLeXmOrA

    Joined:
    Aug 23, 2013
    Posts:
    9
    Hi @Tryz

    Thanks for an amazing asset.

    I only have one doubt. I've been trying to stop all movement and animations of the Motion Controller, but with no success.

    I've tried these:
    - Disabling MC with its IsEnabled variable (it works in movement, but the actual animation keeps running).
    - Disabling InputSource with its IsEnabled variable (no effect).

    Do you think you can help me with this? Much appreciated.
     
  20. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    The animation is actually occurring through Unity's animator controller. So, once the MC starts an animation it's playing through Unity.

    By disabling the MC, you stop the MC from activating new motions and animations or managing the existing animation. However, it won't "hard-stop" the animator.

    Using the Input Source's IsEnabled property just determines if it should return input or not. It doesn't have anything to do with animations.

    To do a hard-stop of the animation, you'll have to stop the animator itself. I'm not exactly sure how to do that, but I'm sure it's in Unity's documentation.
     
  21. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    I use AC and made correct integration of MC. I use direct movement so it give full controll to MC. How can I setup MC to wlak if i right clik too ? I found a bit of help in your manual with making a simple motion for hit fire2 but how do i use this in the animator ? I can reffer to the correct transition, I got that, but wich one is it ? Anystate>Walk Transition ? should i add 2 more conditions with L1 ? (I dont understand very good what L0 and L1 do)
    check here:
    http://myprintscreen.com/s/tpbp/214d379775
    it actually moves a bit :) but its not going to the clicked location :)

    also, if i want to assign multiple behaviours to Fire2 i must add more Simple Motions and name them differently and put the correct phaseID so it triggers them when is the case ?
     
    Last edited: May 25, 2018
  22. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    different topic: is it possible to use MC to enable scrolling Cinemachine camera ? or it only works with your Camera controller ?
     
  23. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    The MC will work with any camera. All it really cares about is a Transform for some of the motions like Walk Run Pivot.
     
  24. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    If I follow correctly, you want a custom Input Source that would only return MovementX and MovementY values if the right click occurs.

    Let's take these questions off line. Can you please email tim@ootii.com your Unity Order IDs and I'll help how I can. Thanks!
     
  25. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    I found a script helping me achieve what I needed, don't worry to work extra 4me, thank you. My main issues are to combine with AC and sometimes it gets confusing.
    Anyway it seemed to me to be more intuitive with MC but it seems it is not unfortunately for beginners.
     
  26. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Sounds good. Glad you're moving forward.
     
  27. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    488
    Hi Tim,

    Have to try things in 2018.2.0b5 (have a breaking bug in 2018.1.1 from an Asset which is fixed in 2018.2....)

    Got an error (blocking compiler) from one of Ootii assets (don't know which one :S)
    Image 205.jpg

    Would you have by any chance a clue about it?
     
  28. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I think I know what it is.

    Unity's Quaternion didn't have a "normalize" function. So, I added one. It looks like they've now added it and that's causing an issue.

    That specific line is the QuaternionExt.cs file at line 313. I believe you can change it from
    rTwist = rTwist.Normalize();

    to:
    rTwist = rTwist.normalize;

    I haven't put on U 2018.2 yet, but try that or some variation.You may find it in other places too. I'll have to think about how to fix this for U 2018.2 and higher, but not anyone lower.
     
    Necka_ likes this.
  29. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    488
    Thanks it worked, it was almost that. The good one is:

    rTwist = rTwist.normalized;
     
    Tryz likes this.
  30. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    I succeded in making the character move on mouse click with a script file and a state but I think the state must be inserted in WRT state becasue there are some conflicts in movement: the wasd only plays animations and does not move the character.
    Quick update: the wasd works in paralel with the mouse with some small glitches but I must look more into it. Still I think the state I created should be included in WRT.
     
    Last edited: May 27, 2018
    Tryz likes this.
  31. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I'm not really following.

    If you'll email tim@ootii.com some screenshots of what you're doing, I might be able to help. Please include your Unity Order ID for the MC.
     
  32. AdminArdagor

    AdminArdagor

    Joined:
    Feb 6, 2018
    Posts:
    42
    Hi Tim,

    tell me please : where (in code) is the beginning of processing keystrokes - "1" key - (transition to sword and shield mode), "2" key - (transition to bow mode), "3" key - (transition to spell mode) in the *.cs scripts (name script and line)? I would like to redefine them to other keys in the code.
     
  33. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    In the BasicInventory.cs, there's a property (UseNumberKeys) that syncs the order of the Weapon Set list with the number keys.

    In the Update() function at line 325, I test for the number keys being pressed (if UseNumberKeys is true). If it is, I simply call SwapWeaponSet(index) as a coroutine.

    So, you can uncheck the "Sync Number Keys" option in the inspector (I think that's the title) and create your own component that uses the keys you want. Then, call my ToggleWeaponSet(index) function on BasicInventory. That function will call SwapWeaponSet(index) as a coroutine.

    No need to change any of my code. :)
     
    TeagansDad likes this.
  34. Invirtuo

    Invirtuo

    Joined:
    Nov 30, 2016
    Posts:
    14
    Hi,

    Here is my problem:

    I have an NPC character moving to a point using Nav Mesh Input Source

    Once the character reach the point, I want to use an Animator trigger to activate a custom animation that does a single step then rotate to sit on a chair.

    The problem is: that the characters does not apply any root motion, it does the animation in place without moving or rotating to the sitting position. If I remove completely the Motion Controller component, the animation is working. However, it is not working even when I try to just deactivate the Motion Controller.

    Is there a way to do it, temporarly give back the root motion control to the animation?
     
  35. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    Your best bet would be to set up your animation to run as a Simple Motion, rather than bypassing Motion Controller and setting a trigger parameter on the Animator directly. MC is constantly updating the Animator, so you'll run into problems if you do this. The docs have an example of setting up a Simple Motion, IIRC.
     
    Tryz likes this.
  36. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    The other thing to remember is that Unity stops applying root-motion if a script exists that implements the OnAnimatorMove function (which the MC does). So even with the MC disabled, Unity is probably ignoring the root-motion because that function still exists.

    I haven't tested it, but that's my theory.

    Using a Simple Motion is probably the best bet and should be easy to setup.
     
  37. Invirtuo

    Invirtuo

    Joined:
    Nov 30, 2016
    Posts:
    14
    How do I trigger a simple motion? I don’t want to use input because it’s an NPC. Can I simulate an input or call an allias directly on my NPC and how?
     
  38. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Super simple...

    You can have an "Action Alias" which is just an entry in Unity's standard Input Manager.

    1. Ensure you have a name that exists in Unity's Input Manager


    2. Type that entry in the Simple Motion's "Action Alias" field


    Or, you can force a "Simple Motion" the same way you do a regular motion by calling MotionController.ActivateMotion(). In the documentation at page 30, I give you an example:
    http://www.ootii.com/Unity/MotionController/MC2Guide.pdf

    Code (CSharp):
    1.  MotionControllerMotion lMotion = mMotionController.GetMotion(0, "MyMotion");
    2. mMotionController.ActivateMotion(lMotion);
    3.  
    I hope that helps.
     
  39. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I forgot to answer this part...

    That's a loaded question because NPCs still move, jump, attack, etc. So, my Nav Mesh Input Source simulates input and causes all of that to happen using the same motions that PCs use.

    To learn more about NPCs, start with this video:




    You can create a custom input source that does simulate input. That's exactly what my Nav Mesh Input Source does. To learn more about Input sources, check this out:

    Input Sources
     
    Last edited: May 30, 2018
    TeagansDad and John-Lisenby like this.
  40. Invirtuo

    Invirtuo

    Joined:
    Nov 30, 2016
    Posts:
    14

    Thanks it helped a lot.
     
    Tryz likes this.
  41. NicoFlows

    NicoFlows

    Joined:
    Feb 23, 2016
    Posts:
    5
    just ran across your stuff on the asset store an they look great. I had a couple questions:

    1: Have you ever tried or help someone integrate you controller and camera with something like
    https://assetstore.unity.com/packages/templates/packs/mfps-2-0-multiplayer-fps-101171

    2: Do you have a recommended multiplayer asset/framework to use with your assets?

    3: For the Shooter Motion pack it says ....Requires: Mixamo's free Pro Rifle Pack but the link goes to unrelated landing page?

    4: Do you have anything in the works for controlling vehicles and character animations for entering an exiting them?
     
  42. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    I'm not sure what you'd want to add to Motion Controller from the MFPS system .. maybe just the Photon part? If so, you might inquire about using Photon (which is free) with Motion Controller.

    I don't own MFPS, but my guess is that it is a set of scripts that closely integrate Photon networking, character controller, GUI, and AI, and it might be difficult to break that all apart to try to use it with Motion Controller.
     
    Tryz likes this.
  43. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey @NicoFlows ,

    As @hopeful said, I'm not sure. Typically you only have one character controller on a character at a time.

    I know people are using UNet, Photon, and Photon Bolt. You can check out my Multiplayer Networking post here:
    Multiplayer Networking

    I also have a video showing a simple UNet setup:


    I just tried it. It's the search page for "Pro+Rifle+Pack". It's the first set of "animation cards" titled "Pro Rifle Pack":



    The documentation will take you through it step-by-step:
    Shooter Motion Pack Setup

    While you can use the included Actor Controller for controlling vehicles, you'd have to set that up. There's nothing out-of-the-box for entering and existing vehicles. That said, the MC is built to be expanded on and I know others have added the ability to ride horses, submarines, motorcycles, etc.
     
  44. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Vacation time!

    The family and I will be taking off for vacation soon. I'll have internet some of the time and will do my best to respond when I can. Just don't be surprised if it takes me an extra day or two.

    I also decided not to push some updates that I was planning. It just didn't seem smart to do it right before I leave. I'll push them when I'm back.

    Have fun and I'll talk to you soon. ;)
     
  45. Twoonebe

    Twoonebe

    Joined:
    Mar 30, 2013
    Posts:
    174
    Hi i have a question about Motion Controller,

    how can i setup a perfect top-down controller ?
    I show the demo but the camera did not follow the player and the three type of cammera orbit scroll and follow are very ugly to play ?
     
  46. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Since what you think is perfect or ugly is subjective, you will have to play with the different camera setups to get the feel you want.

    If you see the post above yours, I won't be able to give you specifics for a while.
     
  47. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    Have a great vacay. :)
     
  48. luekio

    luekio

    Joined:
    Jan 23, 2018
    Posts:
    24
    Hey folks, I'm having an issue getting the motion controller to work with my rig. I've followed the manual many times without luck. Maybe someone has an idea what the issue is. Here's a break down.

    Import humanoid rig, add actor controller, add actor driver, add input (unity) and connect it to actor driver. This works fine, the character will move jump etc without animations.

    Add motion controller and then it doesn't work. The controls at this point go weird. If I manually look in the animation window, I can play the animations on my rig and they apply fine, so the functionality is there... but the motion controller won't trigger them.

    Any advice appreciated.

    Thank you!
     
    Last edited: Jun 5, 2018
  49. John-Lisenby

    John-Lisenby

    Joined:
    Nov 8, 2013
    Posts:
    122
    @luekio
    Try removing the Actor Driver. Should have only Actor Controller and Motion Controller. Also, check your import settings to see if rig is set to human.

    I had some issues with the Actor Driver, and my understanding is it used for NPC's for movement and not for player movement.

    Hope this helps,

    John
     
    Tryz likes this.
  50. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    @luekio, @John-Lisenby

    The Motion Controller essentially is the Actor Driver (it says as much in the AC documentation). So you would never add an Actor Driver when using it, as it will conflict.
     
    Tryz likes this.