Search Unity

Motion Controller

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

  1. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    @eblumrich , If you don't have my Game Core object in the scene I wouldn't be forcing the cursor to be active. I'm wondering if the Game Core component is setup from some demo. In which case, @TeagansDad is right about checking the box.

    If you still have an issue, feel free to email tim@ootii.com directly.
     
  2. YCE2010

    YCE2010

    Joined:
    Jan 23, 2013
    Posts:
    27
    Hi
    I´m adding Spell casting to my game and I get a problem. My character don´t get damage from spells. I´m using NPCs like enemies, my character is the target but the enemies only cast the spell if my character is in line with other NPC and even I´m the target the other NPC get damage but not my character. My character use Motion Controller with Spell Casting Pack added, of course. Why can this happen? Look the image.
    Thanks you in advantage.
    Best regards
    Spell casting.jpg
     
  3. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    It really depends on the spell.

    The spell you're casting looks like Burst Lighting. If you look at the "Utility - Select Target" node in the spell editor, it defines which characters will be effected:



    In this case, I'm guessing your NPCs don't have the required Actor Core component.
     
  4. YCE2010

    YCE2010

    Joined:
    Jan 23, 2013
    Posts:
    27
    Hello, thanks you for answer.
    My NPCs and Character have the required Actor Core. I was looking Layers, Tags and other, and it seems all is well. Really I don´t know what happen.
     
  5. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Did you put in any break-points to see if the Reactor is getting a damage message?
    https://ootiigames.com/?page_id=17

    I'm sure we're just missing something in the setup since my demos work. Go ahead and email tim@ootii.com a small project and I'll take a look.
     
  6. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,163
    Good plan.
     
    Tryz likes this.
  7. YCE2010

    YCE2010

    Joined:
    Jan 23, 2013
    Posts:
    27
    Hi
    Sorry, I can´t send a small project because my project is a big project with many dependencies, and I tryed to create a small project for you, removing scripts from my character and in that case the trouble don´t happens, is rare. Here I send you more data, maybe with this you have any idea about what happens. Really it seems that the problem is not with Reactors. My character is the target but is not recognized for the NPC to cast the spell. Even I´m the target, the spell just is casted by NPC if my character is in line with other player or NPC. I was looking in ParticleCore of Spell and my character is not the Attractor, but he is target. The Attractor is the NPC behind me. Other thing that maybe is important, if I try of set the target using the unity editor in realtime, my character don´t appear on window of possible targets even though it has the Combatant script. I´m assigning the character as target by code. It's as if something is missing in my character, that the atacker needs for cast the spell.
    Best regards and thanks in advanced.
     
  8. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    So, it sounds like it really is something specific to your scripts or setup.

    Unfortunately, I'm not really sure how to help.

    Since it works in the demos, it works in my testing, and no one else has reported the issue... I think it has to do with one of your scripts or how things are setup (as you confirmed above). Without poking through what you're doing (or not doing), I'm really not sure how to help.

    Otherwise, my guesses are what I've already posted. :(

    I do want to help you, but in a situation like this... you have to help me help you. :)
     
  9. YCE2010

    YCE2010

    Joined:
    Jan 23, 2013
    Posts:
    27
    Thanks you very much. I will try to help you.
    Best regards.
     
  10. dterbeest

    dterbeest

    Joined:
    Mar 23, 2012
    Posts:
    389
    Hi Tryz,
    I recently purchased the ootii Motion Controller and ran into an issue (probably im doing something wrong)

    I dragged the basic PlayerBot prefab into a scene and wanted to add the punch motion, so i created a second layer and added the punch motion. So far so good, because when i click the mouse button the character punches. However, the punching seems to disable the Locomotion layer, as the character is unresponsive after a punch (keeps walking in a straight line, or keeps standing still)

    Any pointers to what i might be doing wrong? I'm using Unity 2018.2 beta.

    EDIT: Doing a jump or fall does seem to 'reactivate' the locomotion..

    Thanks in advance,
    Dennis
     
    Last edited: May 9, 2018
  11. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Welcome @dterbeest ,

    I'm not seeing an issue and I tried in U2017 and U2018. Here's what I did:

    1. I opened the demo_Climbing scene
    2. Hit play to make sure I could move around (just as a test)
    3. Stopped
    4. Added a second layer and called it "Upper Body" (the name doesn't matter)
    5. Added the Punch motion to the second layer.
    6. Hit play

    With that, I could walk & punch, idle & punch, jump & punch, etc. Punching never stopped me from walking and stopping or starting to walk. Everything worked fine.

    Can you give that a try? If that works, you may want to compare what's different with your scene.

    You do want to make sure Punch-SM is on the second layer in the animator. Maybe your animator has it on the first layer.

    If you want to email tim@ootii.com a screen shot of the motions in both your MC layers, maybe that will tell me something.

    The punch motion is pretty simple and hasn't changed in years. So, it should be fine.
     
  12. jbparis

    jbparis

    Joined:
    Apr 7, 2017
    Posts:
    5
    Hello,

    I just bought the product. I just started the demo_interacting scene and was surprised to find that the interactions don't work on the sphere and on the chest (i see no yellow highlight). On the door it looks okay but the yellow highlight seems to come on any way. Do you have a clue ?

    Regards
     

    Attached Files:

    • nul.png
      nul.png
      File size:
      105.7 KB
      Views:
      704
  13. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    It does.

    I just did the following:
    1. Started a new U2018.1.0f2 project
    2. Imported the MC
    3. Opened the demo_Interacting scene
    4. Pressed the "Setup Inputs" button on the MC
    5. Hit play
    6. Went in front of the chest and looked at it (it highlighted)
    7. Pressed "F"



    8. Then I went to the door
    9. Pressed "F"



    10. Then I went to the sphere
    11. Pressed "F"



    Everything worked out-of-the-box for me and no one else has reported an issue.

    Did you follow the MC setup steps and press the "Setup Inputs" button the first time?

    Are you sure you are standing in the trigger area?



    I'm happy to help, but this really shouldn't be tricky.
     
  14. jbparis

    jbparis

    Joined:
    Apr 7, 2017
    Posts:
    5
    a)
    Hello, i'm sorry to say that, but even on a fresh second computer, i've these symptoms.

    1/ open unity
    2/ new project
    3/ import the asset
    4/ open the demo scene
    5/ set the input
    6/ launch
    7/ unable to open the chest / take the sphere. (but the door works)


    I managed to remove these symptoms by removing the "use raycast" properties... but this is clearly not an example that works out of box :) That being said, congratulations for your asset, it is wonderfully well programmed and I don't regret my purchase.

    b/ I managed to make FINALIK working to put the avatar's feet on the ground with a slope, would there be a way to do the same for the hands when the avatar climbs on a wall?

    best
     
  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I'm not sure what's unique about you vs everyone else, but the video below clearly shows it works out of the box. ;)

    I didn't pause the video or anything. It's just a straight install and run...



    Any information about your setup might help: Unity version, platform, .NET version, etc.

    Make sure your layers are setup correctly. Unity doesn't import layers from assets unless you import the "project" and I don't like to do that as it messes with your previous project settings.

    Sure. Final IK is just moving the bones each frame after animation. Just like the feet, you'll find a point close to the edge for the hands and use Final IK to pull the hands to it.

    If you look at my Climb_1m.cs, you'll find a TestForClimbUp() function that calls my RaycastExt.GetForwardEdge() function. That should help you find an edge.
     
  16. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    It should still work in a clean project though. The layer mask references remain intact, even if those layers aren't named. They're still there, just hidden from the layer selection dropdowns.

    @jbparis - do the chest and sphere get highlighted with yellow like the door does? If they're not even getting highlighted, try getting the chest or sphere in the exact center of the screen, as that's where the raycast originates. ItsI easier to do this if you add a Reticle component to an empty GameObject (or copy over the Reticle/Cursor from the Archery, Shooter, or Spellcasting demo scene).
     
    Tryz likes this.
  17. proepkess

    proepkess

    Joined:
    Dec 26, 2016
    Posts:
    11
    This takes forever when I hit play in the NavMesh-ExampleScene (BodyCapsule.cs): https://i.imgur.com/ju4OFpW.png

    I've found out that the large value comes from _Offset.Y is set to 80000000

    Edit: found the bug in Vector3Ext.FromString line 452

    Deserializing the string ""(0, 0.80000001, 0)"" results in a wrong vector, because float.Parse("0.80000001") returns 8E+07

    Edit2: Fixed it for me by this line:

    rThis.y = float.Parse(lTemp[1].Replace(".", ","));
     
    Last edited: May 11, 2018
  18. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I think this may be a localization issue during deserialization.

    In your country do you write numbers like this "8,000,000.00" or like this "8.000.000,00"?

    In Vector3Ext() at line 18, you'll find that I've commented out the line that forces a US cultural setting. Can you try uncommenting that line and see if it fixes the issue for you without your modification?

    Code (CSharp):
    1. System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
    You may have to put that line somewhere where you know it runs before that code you showed runs. Even if it's just temporary.
     
  19. Invirtuo

    Invirtuo

    Joined:
    Nov 30, 2016
    Posts:
    14
    Hi,


    I have a problem,


    I made an NPC walking to different waypoints using your tutorials: Motion Controller & NPCs #0 - Movement Overview" & Motion Controller & NPCs #1 – Introduction.


    I use the Nav Mesh input source, I do not use the “Use Transform” option in the Actor Controller, I checked “Rotate on input”.


    The problem I have is that when the NPC reach a specific point I want it to rotate toward a specific object. However, I cannot make him rotate towards or look at at the object, even if I try manually in the inspector it will not rotate in play mode…
     
  20. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    When you do not check "Use Transform", you can't use (meaning set) the transform directly.

    The Actor Controller is managing the position and rotation of the character internally. So, you can't just change the position or rotation using transform.position = x or transform.rotation = x.

    You have to use the Actor Controller's functions:
    SetPosition()
    SetRotation()
    Move()
    RelativeMove()
    etc.

    If you want to force the position or rotation specifically, use SetPosition() or SetRotation().

    If you want the NPC to rotate towards a specific object after reaching a specific point, you'll need to add code that calls SetRotation() to get the rotation you want.
     
  21. Mlackey

    Mlackey

    Joined:
    Dec 5, 2014
    Posts:
    41
    2018.1.0f2 - Not sure what is going on, tried multiple times and followed the startup guide. Any help or known issues with 2018? Just purchased the asset set today + archer, sword, spell extensions.


     
  22. nomax5

    nomax5

    Joined:
    Jan 27, 2011
    Posts:
    365
    Hello !!! long time no Visit...

    How difficult would it be to make this multiplayer these days?
     
  23. nomax5

    nomax5

    Joined:
    Jan 27, 2011
    Posts:
    365

    Nevermind I found a post Doh...

    "Note to self search the forum with correct spellings"
     
    Tryz likes this.
  24. Tryz

    Tryz

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

    All of those errors have to do with the "MotionState" class. For example:
    "Motion State does not contain a definition for InputX"

    If you open my MotionState.cs, you'll find InputX defined at line 102.

    I believe what's happening is that you've got another class in your project called "MotionState" as well, but it's not using namespaces like every good class should. That means my code is picking up the bad MotionState and not my MotionState.

    Think of namespaces like last names. When you say "Tim, come here" you don't know who you'll get. If you say "Tim Tryz, come here" you'll get the right one. This is the same thing. :D

    MotionState is core to my whole system. So, you definitely want to find the bad one and fix it.
     
    Mlackey likes this.
  25. Mlackey

    Mlackey

    Joined:
    Dec 5, 2014
    Posts:
    41
    Went through and found out one of the assets I had from the store had just that issue and I went about fixing it. Poor code indeed. Took a little bit of time but was indeed the issue.
     
    hopeful and Tryz like this.
  26. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    Might want to notify that dev that regular use of namespaces is highly encouraged. (IMO, the UAS ought to make it a store requirement.)
     
    Mlackey and Tryz like this.
  27. MarkusGod

    MarkusGod

    Joined:
    Jan 10, 2017
    Posts:
    168
    Hi @Tryz, I don't find Easy input thread so, I'll post here, just a little heads up for obsolete API usage:
    Code (CSharp):
    1. Assets/ootii/Framework_v1/Code/Input/InputManagerCore.cs(98,17): `UnityEngine.Object.DestroyObject(UnityEngine.Object)' is obsolete: `use Object.Destroy instead.'
     
    Tryz likes this.
  28. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Thanks for that. I'll make that part of this week's update.
     
  29. Sigstan

    Sigstan

    Joined:
    Nov 13, 2013
    Posts:
    16
    "Try getting the chest or sphere in the exact center of the screen, as that's where the raycast originates."

    That is the solution.

    I initially had the same impression as jbparis with regard to the demo_interacting, but I realized that it is all about the angle of the camera. The chest will not turn yellow, if you for example look from behind the player at shoulder level. You need to look from above the player down at the chest and kind of center it, then it will turn yellow. Same applies to the sphere, although the angle is slightly different. The door is as tall as the player, and is much easier to "activate".
    If users know how the interaction feature is supposed to work, then no problem, but the view angle aspect of it might confuse some people, if used it in-game.
     
    Last edited: May 13, 2018
  30. Mlackey

    Mlackey

    Joined:
    Dec 5, 2014
    Posts:
    41
    Already notified and shared my code fix with them. Hopefully they'll update soon.
     
    hopeful and Tryz like this.
  31. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Honestly, I really didn't think it was tricky to use. I figured it worked like Assassin's Creed:
    https://www.dropbox.com/s/5zkthki4n59jr0c/InteractGIF.gif?raw=1


    In the documentation I mention "When an interactable is being looked at...". I just assumed people knew that meant the raycast was coming from the center of the camera.
    Object Interactions

    The raycast is pretty "fine", but you can oversize your "Raycast Collider" if needed.

    If the "Trigger Collider" part is tricky, you can oversize that too or simply remove the collider.



    I'm happy to reword things if it helps. Just send me what you think would be better for the docs.
     
    Last edited: May 13, 2018
  32. Sigstan

    Sigstan

    Joined:
    Nov 13, 2013
    Posts:
    16
    After reading the object interactions section again I think it is okay. It is actually mentioned in the Notes section that the ray cast is very specific. I didn't see that in the first read-through.
     
    Tryz likes this.
  33. Chris-Clark

    Chris-Clark

    Joined:
    Jan 16, 2012
    Posts:
    130
    Quick tip on something I ran into. I somehow misplaced my head (Top Transform in the Body Capsule settings), I have no idea how but I'm good at losing things so it doesn't surprise me.

    Without that, everything was crazy. I could walk through most of my mesh colliders. I could never actually land on anything, just hover over them with the Fall animation. Colliding with other things was very jittery. And who knows what else.

    So if things seem to have gone all wrong, check to see you haven't lost your Head. ;)

     
    notno and Tryz like this.
  34. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    hahaha... great tip.

    I could see where it would go whacky. Without the transform, the "Top Offset" is based on the root. With a value of (0, 0, 0) it means the "top" is below the "bottom". There may be something I can do to help, but on it's face that would definitely cause oddities.
     
    hopeful and Chris-Clark like this.
  35. f0ld

    f0ld

    Joined:
    Jan 7, 2014
    Posts:
    3
    Hi,

    I've trawled through this forum trying to find a solution to my problem, but can't seem to get things working. I have some custom animations set up that I'd like to trigger via GUI buttons. If I set them up as Simple Motions and give them an Action Alias they all work fine. The problem comes when I don't want an Action Alias and just want to trigger the animations via the on screen buttons, I'm getting NullReferenceExceptions from the GetMotion line.

    I tried using the code that was put on here where someone else asked about buttons, but again get the NullReferenceException. The Simple Motion's named "Chopping". I don't know enough about the Asset at the moment to know where the error is coming from

    Code (CSharp):
    1.  void SomeClickFunctionHandler()
    2.     {
    3.         MotionController lMC = gameObject.GetComponent<MotionController>();
    4.         SimpleMotion lMotion = lMC.GetMotion("Chopping") as SimpleMotion;
    5.         lMotion.PhaseID = 8600;
    6.         lMotion.OnDeactivatedEvent = OnSimpleMotionDeactivated;
    7.         lMC.ActivateMotion(lMotion);
    8.     }
    9.  
    10.     void OnSimpleMotionDeactivated(int rLayer, MotionControllerMotion rMotion)
    11.     {
    12.         rMotion.OnDeactivatedEvent = null;
    13.     }
    Any help appreciated!
     
  36. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I took your code and put it into a scene and I'm not having an issue. Here's what my full code looks like:

    Code (CSharp):
    1. using UnityEngine;
    2. using com.ootii.Actors.AnimationControllers;
    3.  
    4. public class F0ld_Custom : MonoBehaviour
    5. {
    6.     private void OnGUI()
    7.     {
    8.         if (GUI.Button(new Rect(10f, 10f, 100f, 20f), "Activate"))
    9.         {
    10.             SomeClickFunctionHandler();
    11.         }
    12.     }
    13.  
    14.     void SomeClickFunctionHandler()
    15.     {
    16.         MotionController lMC = gameObject.GetComponent<MotionController>();
    17.         SimpleMotion lMotion = lMC.GetMotion("Chopping") as SimpleMotion;
    18.         lMotion.PhaseID = 251;
    19.         lMotion.OnDeactivatedEvent = OnSimpleMotionDeactivated;
    20.         lMC.ActivateMotion(lMotion);
    21.     }
    22.  
    23.     void OnSimpleMotionDeactivated(int rLayer, MotionControllerMotion rMotion)
    24.     {
    25.         rMotion.OnDeactivatedEvent = null;
    26.     }
    27. }

    I then put this on the MC character and pressed the GUI button... he animated as expected.

    Since your error is happening on the GetMotion() line, I'd have to guess that "lMC" is not valid. Are you sure you put your component on the the GameObject that has the Motion Controller component?

    [EDIT]
    Also, make sure you have a motion named "Chopping":

     
    Last edited: May 15, 2018
    twobob, f0ld and hopeful like this.
  37. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    I just picked up the Motion Controller and am considering using it in a TPS game but I have a couple of questions. Does the Shooter Motion Pack offer more flexibility over the camera? i.e. zoom in and out over the player shoulder, etc.
    Thanks for any help.
     
    Last edited: May 15, 2018
  38. Tryz

    Tryz

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

    Not the Shooter Motion Pack, but the Camera Controller does. The "CC" is my advanced camera solution that uses different motors for placing the camera, zooming, changing styles, etc.

    All of my assets can use the basic camera rigs that come with the MC, the advanced CC, or your own custom camera setup.

    With the CC, you can setup a motor that is over-the-shoulder and only activates when you're aiming a weapon. That's what I do with the Shooter Motion Pack and the Archery Motion Pack (if you own the CC as well).

    There are three options:

    You would do that through Unity's standard animator state. You can just click on the animator states you want to speed up or slow down and change the "Speed" value. This approach works good and keeps the animation and movement in sync, but can sometimes look funny if the animation is too fast... you'll look like The Flash. :)

    For something like walking or running, you can also go to the "walk/run" motion that you're using (ie Basic Walk Run Pivot) and set the "Walk Speed" and "Run Speed". Doing this stops root-motion and applies your custom speed. Just be aware that you'll see foot sliding as the movement isn't in sync with the animation.

    Finally, you can change out the animations in the animator states and use custom animations that have the look and speed you want.
     
  39. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    @Tryz thanks for the reply. I did a little digging and noticed the "Walk"/"Run" speed settings. Also the Shooter Controller looks like more than I would've suspected so I'll go ahead and pick that one up. As far as the camera, I'll code that up myself :)
     
    hopeful and Tryz like this.
  40. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Totally cool.

    Check out the FollowRig that's part of the MC. You'll see that it taps into the Actor Controller's OnControllerPostLateUpdate() event.

    While not requited, this is useful because it keeps everything in sync. With it, you'll know the camera is updating after the character. This helps when the camera needs to be based off character movement. :)
     
  41. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    487
    Thanks for the help
     
    Tryz likes this.
  42. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    hi i have Ummorpg asset my question if this asset works with the Third Person Motion Controller?
     
  43. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I think that's a better question for the UMMORPG developers.

    The Motion Controller won't have an issue working within other game frameworks like UMMORPG, but they typically have their own character controllers and ways of doing things. I don't know if they will have an issue with an external character controller like the MC or not.

    While I'm familiar with UMMORPG, I haven't used it myself.
     
  44. Chris-Clark

    Chris-Clark

    Joined:
    Jan 16, 2012
    Posts:
    130
    I'm trying to get some instant detailed controls working, without any momentum.

    When using Root Motion, the movement stops completely when my animation stops. That works great.

    When using WalkSpeed and RunSpeed overrides (in UpdateRootMotion), there is a short slide to a stop and I can't find anywhere in the code where I can change it. It's not because of the Smoothing Samples, not because of the FloatValue variables at all, it's not the ForcedInput, it's not any animation exit times or transitions, it's not the OnAnimatorMove call. And it's not the ramping on the inputs, my inputs change immediately.

    I'm using the built in BasicWalkRunFocus motion, set .

    At some point right at or after UpdateRootMotion on the motion this momentum starts to appear. Right before it, all the inputs immediately change. But sometime after UpdateRootMotion, only when overriding to walk and run speeds, mMovement starts to have momentum.

    Is there a momentum style slowdown in Actor Controller itself, when you're not relying on Root Motion? I can't find anywhere in the ActorController that would do that though.

    Video:


    Thanks for the help again.
     
  45. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    No. The AC will only do exactly what it's told. There's no momentum used.

    What's odd is that if I open my demo_TopDown scene (which uses BasicWalkRunFocus) and set the Walk Speed and Run Speed, I don't have that slide.

    I would have thought the Smoothing Samples could be one of the reasons, but you mentioned that.

    Did you change the animations at all? I use an Idle "pose" which creates a really short transition. If you were to replace that with a longer animation, I could see the transition taking longer and causing something like this.

    What about the Unity Input entry values. Unity's "Horizontal" and "Vertical" entries can actually have sensitivity and drag for keyboard and mouse buttons. Is it possible you're seeing input lag from that?

    Any other customizations you may have done... even if it doesn't seem like it would matter?

    My only other suggestion is adding some debug lines at the end of the Update() function in the motion. This way you can see if the BWRF motion is actually still running and what it thinks the mMotionController.State.InputX values are. That may help us determine if it's an input issue, motion timing issue, animation issue, etc.
     
  46. Chris-Clark

    Chris-Clark

    Joined:
    Jan 16, 2012
    Posts:
    130
    I was using custom animations, and had replaced the idle. But I tried again with everything default (the original Controller and Motions) and get the same problem.

    I then created a fresh project in a new empty folder and imported Motion Controller again, and get the same problem in the demo_TopDown.

    I played with the Unity Input settings and can't make a difference, either with huge Gravity/Sensitivity or 0 on the Horizontal/Vertical. Most of my tests from earlier were using a lot of debug statements to see exactly when the values changed. And the Input change was always instant for me, and the animation and movement was instant when using Root Motion as well. But once I set an explicit walk and run speed, this momentum appears.

    I even edited UnityInputSource and replace the check for the keys in MovementX with:
    Code (CSharp):
    1. lValue = (int)(Time.time) % 2;
    So that it moves to the right every other second. Still slides.

    And according to the Asset Store I am on the latest version, it wouldn't let me download a new one, just import.

    For the demo_TopDown, just tapping the keys will initiate the full slide, tapping looks great in Root Motion, but not with a set speed. I also used the Time modulus from above in this new clean project and it still recreates the problem.

    Edit: I did add a debug to the end of the Update() in the Motion like you suggested. The Update does continue to run all the way to when the sliding stops.

    These are my settings on the motion, the only thing I touched in the demo scene. I hope you can manage to recreate it. :( No rush though, and thanks again.


    And a video of the slide:
     
  47. f0ld

    f0ld

    Joined:
    Jan 7, 2014
    Posts:
    3

    I did have the code on the GameObject with the Motion Controller component.
    I've just created a completely fresh project and re-imported the assets and it's working fine. Not sure what's different, but it's working! :)
     
    twobob and hopeful like this.
  48. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    By using your settings (especially the Default to Run), I was able to reproduce it.

    When "Rotate to Input" is checked, I force the movement value and that's causing the sliding.

    Make these changes to BasicWalkRunFocus.cs and see if it helps (it did for me):

    1. Surround line 252 with this:
    Code (CSharp):
    1.  
    2.                     if (mMotionController.State.InputForward.sqrMagnitude > 0f || mInputX.Average > 0f || mInputY.Average > 0f)
    3.                     {
    4.                         rMovement = Vector3.forward;
    5.                     }
    2. Surround line 362 with this:
    Code (CSharp):
    1.                 if (mMotionController.State.InputForward.sqrMagnitude > 0f || mInputX.Average > 0f || mInputY.Average > 0f)
    2.                 {
    3.                     lInputForward = Vector3.forward;
    4.                 }
    5.  
    This will stop forcing the value if there's no input or smoothing left. I'm not sure of the reproductions yet as it's been a long time since I was in this code. But, give it a try.

    Knowing you changed the animations was also a bit of a trigger as the transition from the walk/run blend to the idle depends on the length of those animations. Dragging out the transition would keep the motion active and the lengthen the slide.

    Hopefully this works.
     
    Chris-Clark likes this.
  49. Chris-Clark

    Chris-Clark

    Joined:
    Jan 16, 2012
    Posts:
    130
    It works!

    So everything else was based on the input values, but on _RotateToInput it was set to unit length, basically full speed. So is the issue here that the animator kept running for a bit, and the full input speed was then running right till the Motion was done?

    It now works again, with your one frame idle as well as my longer idle animation too, though there is a bit of a jerk in the transition. I read about why you use the 1 frame idle and about adding other transitions to idle animations from it in your docs last night so will look into that later.

    But I didn't notice any difference between the one frame idle vs. my longer one in the root motion situation, the character still instantly stopped and started the idle animation correctly.

    Thanks for the awesome support and fast responses.
     
    Tryz likes this.
  50. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Good to hear.

    With Rotate To Input, the character is always moving forward and rotating to the direction of the input. So, I forced that to "forward". As long as the motion was active, that took place. A longer transition could keep the motion active, but may not in your case.

    The condition I had you put in probably should have been a good check from the beginning.
     
    hopeful and Chris-Clark like this.