Search Unity

Motion Controller

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

  1. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    What would be the best way to create target lock motion? No need for animations, so most of the stuff will be removed from the script. The question is what is the minimum I should leave. Maybe someone already have such script?
     
  2. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Great question.

    If you go to the Vault, check out the Morph3D Mouth Blendshape download. It has a motion that doesn't use animations, but controls Morph3D blend shapes (for the mouth) in code.

    The flow for a "code-only" motion is the same. TestActivate(), TestUpdate(), Activate(), Deactivate(), and Update() are all still valid (use them if you need them).

    The one thing to remember is that motions are built to run one-per-layer. So, if you want a code-only motion to run all the time or in parallel with another motion, you'll have to put it on a separate Motion Layer. Not a big deal, just something to remember.
     
    montyfi and hopeful like this.
  3. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Thank you for advice!
    Another question, how to access Animation Events in Motion?
    I tried to add function to it, but animation cannot find it, need some workaround. Or maybe there is another way. What I want to do is apply force to target when event is triggered in hit animation.
     
  4. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I haven't done a lot of work with Animation Events. Since you can't put scene objects into an Animation Event (since the animation lives outside the scene), you would need to create a prefab that can capture the events and use an instance of that prefab to handle the messages. From there, you could tap into the MotionController and motions.

    Personally, I prefer to just check the time in the motions themselves.

    Code (CSharp):
    1. if (!mTriggered && mMotionLayer._AnimatorStateID == STATE_Idle && mMotionLayer._AnimatorStateNormalizedTime > 0.5f)
    2. {
    3.     mTriggered = true;
    4.     DoSomeFunction();
    5. }
    This approach has worked for me and everything is encapsulated in the motion itself. It's also fast as we're just comparing a bool, an int, and a float.
     
    Last edited: Mar 29, 2016
  5. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    That approach is good, but I have several different hit animations with different timings. In that case animation events are much simple way to get the result independently from used animation. Animation sends event to underlying object by default, no need to define object or event coordinator (if I understand your idea correctly).
    What I did is created the simple script and put it on the same character (actually it is on the same level as motion controller, so I have no idea why it doesn't work inside it). It works fine that way, despite to be a little bit cumbersome.
     
    Tryz likes this.
  6. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    For the next update, the active motion will have OnAnimationEvent called if you use that as the event's function name.

    Code (CSharp):
    1. public virtual void OnAnimationEvent(AnimationEvent rEvent)
    I'll bubble the event from the MC up to the active motion. If I can determine the motion layer, I'll only call the active motion on the appropriate layer. Otherwise, I'll call it for all active motions on all layers. The second case should be rare... if ever.
     
    TeagansDad and montyfi like this.
  7. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Pretty interesting, thank you!
     
    Tryz likes this.
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    Hi,

    I saw the @cygnusprojects had done an input source for Rewired for Motion Controller and I thought it might be helpful to include a Rewired Input Manager prefab with the cs file so your users could just take that and modify it without having to do all the same setup each time. I've attached a zip that contains @cygnusprojects' RewiredInputSource.cs and a Rewired Motion Controller Input Manager prefab. I haven't tested it in MC, but all the settings are the same as @cygnusprojects' tutorial (except I made the Joystick Map for the Dual Analog Gamepad Template and I also made maps for the keyboard and mouse.)
     

    Attached Files:

  9. Tryz

    Tryz

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

    Thanks for doing that!

    I have some updates tomorrow. So, I'll actually add what you did to what Cygnus put on the Vault.
     
    guavaman likes this.
  10. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Updates!

    I just pushed out MC 2.16 (currently it's pending review).

    One of the latest features is the ability to capture Animation Events. You can learn more about it in the Guide (page 12).

    I also moved the MC's initialization code from Start() to Awake(). That will help some who were having initialization issues as their Start() was being called before the MC's Start(). I tested this a lot and everything seems good. If you notice an issue with this, please let me know.

    The Vault also has a couple of updates:
    1. @FargleBargle updated the Swim motion
    2. @guavaman added a prefab to the Rewired Input Source
    3. I've added an Easy Touch 5 Input Source

    As always, I'm here to help. :)
     
    Last edited: Apr 2, 2016
    hopeful and FargleBargle like this.
  11. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Hi @Tryz, I'm having a strange problem now. When I click autocreate body shapes it fills Top Transform with Head and body capsule looks good, but as soon I hit play something is clearing Top Transform field and capsule shrinks. When I stop the game that field is not recovered and stays as None.
    Any reason for such behavior?
     
  12. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Unity hasn't updated the MC yet (not sure why). So, the version file still shows it's 2.15 from March 9th 2016. I looked at the code and confirmed it's old too.

    I re-downloaded and did the following:
    1. Created a new scene
    2. Added Jones
    3. Added MC to Jones (per setup)
    4. Pressed "Auto Create" for body shapes
    5. Pressed play and all was good

    Just in case, I then did the following:
    6. Deleted both body shapes (Body Capsule and Foot Sphere)
    7. Pressed "Auto Create" for body shapes again
    8. Pressed play and all was good

    I can understand why the capsule would shrink if there's no top transform. I'm just not sure why it's vanishing in your project, but not mine. No one else has reported this either. So, it's odd.

    Can you follow the same steps with a clean scene and let me know if it works?

    Does your project have anything special like UMA, a saved game system, or anything like that? Just trying to think of what's different.
     
  13. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    I was thinking as well that just because the Top Transform is there, it doesn't mean it's right. Reassigning it from your current character's head bone might be worth a shot, just in case the serialization is damaged, or connects to something different than it seems. I remember having similar problems in testing, and eventually solved them by starting over, and retracing my steps. I'd most likely taken a shortcut somewhere during setup, and just needed to go back and do it by the numbers. :(
     
  14. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Now I have steps to reproduce it on working character (and kill any setup)
    1. I'm using puppet master and opened Ooti Puppet Temple (Final IK) scene. Head transform here and not disappearing on play. Good.
    2. Now assign Bottom transform additionally to Top Transform. Assign Jones to it. Hit Play. Both variables disappear and you cannot assign any of them back after you stop the game.
    Here how it looks before hitting play:
    mc_puppet.png
    After hitting play scene is screwed and need to be reloaded without saving.

    Tried the same in MC_Temple scene. Bottom transform disappeared, but Top still here.
    Tried MC_Lab, both transform stays.

    Perhaps I should ask @Partel Lang instead?
     
    Last edited: Apr 3, 2016
  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Ok, I see what's happening...

    When no Bottom Transform or Top Transform is set, the character is the transform. So, setting the transform to "Jones" is exactly the same as if you just kept the field empty.

    If the Bottom Transform or Top Transform is set to the character's transform, I clear it out since it means the same thing. I just added code to keep the transform... but it's really just for looks and to avoid this confusion. This will go in the next update.

    For now, if you want Bottom Transform or Top Transform to be the character (in this case Jones)... just leave them empty. Everything will work as expected.

    I'm not really sure how Puppet Master plays into this.
     
  16. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    The problem that after I did that setup I cannot set top transform anymore, no idea why. So I had to delete the character and start from scratch. And with no top transform defined the character collider is 1/3 of a real character and easily moves inside other colliders.
     
  17. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    The Top Transform (mixamorig:Head) shouldn't clear... at least it's not for me. If the top does clear, I can understand about the short height because the Top Offset (0, 0, 0) would then be based on the root (not the head).

    Just to clarify... in the latest test you did what are your starting values for Top Transform and Bottom Transform? Once you hit play, what are the two values now?
     
  18. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    The starting values are exactly those on picture. When I hit play they both cleared (None), after that even if I set head only it is always cleared until scene reload. Unity 5.3.4p1 pro. It looks like Unity caches something not presented in Editor (hidden UI values?) ?
     
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I'm not seeing the issues with Top Transform at all.

    If you open the MC_Simple scene, it should have Bottom=None and Top=mixamorig:Head. Does Top clear for you when you run that scene?

    What about if you create a brand new scene with just Jones and the MC?

    At this point, we have to start peeling down your project. I just don't know if something else in your project is causing this as I can't reproduce it. :(

    If you want to send a small project to tim@ootii.com, I'll take a look.
     
    Last edited: Apr 4, 2016
  20. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    This was just too good not to share.

    Check out the demo for The Halls of Camelot. They are using the the MC with different sized characters.

     
    TeagansDad likes this.
  21. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Yes, that scene is fine, Ooti Puppet Temple is not. But I'm fine with it at the moment. Just recreated character and not going to change it.

    And another problem. It seems my Unity is completely broken somehow.
    I'm using MCS Female and with Female Animset pro it has its mouth open. I'm trying to fix it using your M3DFace_idle. But it doesn't work for Jaw bone.
    lJaw.localRotation is changing in code, but not visually. It seems Mecanim is changing it after your Update call.
    Maybe I really need to start fresh.
     
  22. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Man, I wish I had a better answers for you.

    I'm running the M3DFace_idle in my scene every day and it's working. I have it on a 3rd layer and the MC runs during LateUpdate(). So, it is running after all the Mecanim animations are applied.

    I just tried moving the M3D Character Manager below my Motion Controller thinking that maybe the M3D Character Manager is doing something in LateUpdate() as well, but that still worked.

    If you can get me a simple scene, I'm happy to see what happens here.
     
  23. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    But have you tested it the latest patch release 5.3.4p1? They have fixed lots of animation stuff, I think it is quite possible that something else got broken.
     
  24. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    No. I'm on 5.3.4f1.

    I figured I'd have to jump to 5.4 soon.
     
  25. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    Has anybody here adapted Motion Controller for use with a Click-to-Move control scheme? I'm going for the classic PC RPG top-down (more or less) camera view where you click your destination point and your character moves there (with his party members following him).

    I've got a component set up on my Player object that gets the raycast to the destination point and feeds this to the NavMeshInputSource included with Motion Controller, and this works for getting the player moving around the screen. I've tried changing the Slow Distance and Slow Speed, but he still usually overshoots the target destination by a considerable amount (Stopping Distance is set to 0.5). I think that I would like him to slow down to a walking speed when he gets close to the destination, rather than skidding to a stop.

    Sometimes he'll also stop and start while moving along the path, which looks strange. If I click on a destination far enough away from the player and hold down the mouse button, he'll adjust his direction fairly smoothly as I move the mouse around. But if I do this closer to the character, he'll start and stop as he moves along.

    I'm using the included MC_NavMesh scene and Jones character to to get the movement working how I want it to. I'm also using ORK Framework and I need to set the MoveAI and Move To Interaction settings to use my custom component. It's easy enough to bridge the Set Position and Stop functions to the NavMeshInputSource, but in order for ORK to set either Walk or Run speed, I need to specify a Set Speed function that passes in a float. I'm not quite sure how to use this to change the simulated input in the NavMeshInputSource in order to adjust the speed.

    Any pointers would be much appreciated. :)
     
  26. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Well, I have created new project, and closing mouth doesn't work there too. Perhaps this is really 5.3.4p1 issue. When I check that motion - mouth momentarily closes and immediately opens back. I'm afraid 5.4 has even more issues, do not want to upgrade yet.

    PS. Or, maybe you are using the old MCS? They have removed GetBlendshapeByName function some time ago.
     
    Last edited: Apr 5, 2016
  27. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    That could be. I haven't upgraded my Morph3D character in a while. I just can't keep up with everyone's updates. :)
     
  28. Tryz

    Tryz

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

    Unfortunately, I haven't done a lot of what you're talking about. But, I figured I might be able to help some. Shoot an email to tim@ootii.com and I'll show you how to get the walking working. I just played with it and it needs a couple of code changes.
     
  29. AiryKai

    AiryKai

    Joined:
    Apr 16, 2014
    Posts:
    52
    Hi, @Tryz . I'd like to know how collisions work in MC. For some reason, my characters pass through Mesh Colliders, if they move quite slowly, for example when walking.

    Besides... I have the ground and environment objects in one layer. I tried to set this layer as "ground" and in collision settings in MC. It does not work very well, because the character stop walking if colliding with obstacles of any size, even if it is a small step.
     
  30. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I'm using all of Unity's physics calls... Raycast, SphereCast, CapsulCast, etc. All the code is there. So, you can check out the ActorController.cs and the body shape files.

    Start in the ActorController.cs at line 2519.

    99% of the time when someone says they are passing through something, it comes down to the Collisions Layer property on the AC not being set to the layers used by wall, other meshes, etc. So, please double check all that.

    Are you using the "Step Height" and "Step Up Speed" properties of the Actor Controller?

    If you're confident you're following the documentation and still having problems, feel free to email me (tim@ootii.com) a small project and I'll take a look.
     
    Last edited: Apr 6, 2016
  31. AiryKai

    AiryKai

    Joined:
    Apr 16, 2014
    Posts:
    52
    I checked it out. The problem is that the collision occurs normally when the character is running. But if he walking, or moves slowly, then the collision doesn't happen.
     
  32. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I'm actually in the MC_Lab demo now and walking is colliding just like running. It's all the same logic... so, speed shouldn't matter.

    Can you get me a small project that's showing this issue?
     
  33. AiryKai

    AiryKai

    Joined:
    Apr 16, 2014
    Posts:
    52
    It seems that the problem in my animations. I don't quite understand why. When I use some of my animations, collisions don't work. It's weird...
     
  34. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Is it possible that your root is staying in one place while your bones are moving forward?

    I've seen some animations (especially when there is no root-motion) that do this.

    Since the body-shapes and colliders are typically connected to the root, I could see where the animation makes it look like you're running through the wall when the reality is your root (and colliders) hasn't moved. Just a thought.
     
  35. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Hey Tim! I have a few questions and apologize if they were addressed already. I did my due diligence but couldn't find info on what I need upon searching.

    To start:

    • In your Motion Controller MAP Motions video, it would appear that it's as simple as adding the MAP motions and they will just work. I suspect there's more to that so can you quickly explain how you added a MAP motion (or subsequently any new motion) to replace the existing one's in your asset?
    • I'm not seeing any Blend-Tree's being used in any of your samples; when you move Jones or the Scientist around the game-world, there's no way to move them diagonally, or a combination of say Forward and Right. Clearly most users are going to need directionals/360' movement, including analog and touch controls that have near infinite direction input (X/Y)
    • Is there a way to trigger a sequence without there being a key press (i.e. "Action Alias")? For example, a character that is sprinting towards a waist high barrier and automatically hurdling over without a key press. I would use a series of Raycasts and determine if the character is walking or sprinting. If sprinting, do a distance cast and if it hit's our low barrier, trigger the Hurdle sequence without any other input from the player. (I suspected NodeCanvas might be good for this after seeing your NPC video)
    All in all I'm fairly impressed, as rolling my own Anim Controller has been a learning curve to say the least, learning all the nuances and idiosyncrasies of Mecanim. :D

    Thank you sir!

    -Steven
     
    kurotatsu likes this.
  36. Tryz

    Tryz

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

    1. MAP Motions
    Check out this video. It gets you 90% there. The only thing I didn't do was import the MAP animations.

    Once you import the MC, import the MAP animations, and import my package from the vault, it really is just a couple of clicks and everything works.

    2. Blend-Trees
    You can certainly use blend-trees with the MC. I've just learned to avoid them (for the most part).

    The main reason is that they don't transition in and out well. So, let's say I'm in a blend tree that goes from idle-to-walk-to-run and I'm currently running. If I stop abruptly, you'd expect me to go from run to some cool transition to idle. With blend trees, you have to go from run to walk and then walk to idle and then out of the blend-tree. Since the style of games I like are a bit more realistic (think Tomb Raider), this ramp-down looked goofy.

    The same goes for strafing-left to strafing-right. In a blend tree, you have to go from strafe-left to idle to strafe-right. That mid idle looked a bit odd.

    Again, you can use blend trees in your own motions. And, I have been playing with blend trees with my bow motions. I just didn't use them in the current set because I couldn't get the look I wanted.

    3. Sequences
    When I think of a "sequence", I think of chaining things together. There's nothing in the MC that will do that automatically.

    However, your example was really about automatically activating motions. That, the MC can do (if you code it). To do that, you'd just code your raycast tests in the TestActivate() function. When the function returns true, the motion would start and vault over per the animations and code.

    My climbing motions are a good example. All the logic is in the TestActivate() function and wrapped with a button-press check. If I just commented that check out... they would activate automatically as you described (I might need a little more testing ;))


    I hope all that helps.

    Once you get into Mecanim, you'll find that it really works pretty well. I just found the MC made it a lot easier for me to organize, manage, and add code to my animations. :)
     
    kurotatsu likes this.
  37. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Perfect...I've been hanging out in your Tutorial Playlist on your YouTube page and didn't catch this video!

    I've had great success doing just that. I have elaborate Transitions To and From elaborate Walk/Run blend-trees that within themselves have varying states for being in and out of combat...boom no sweat!

    Is there anything to note ahead of time in calling a Blend-Tree? I imagine then the entire Blend-Tree would have have a single Phase ID and then I'd manage all the parameters myself as I do now?

    Semantics haha. By "Sequence" I meant 'animation', not subsequent animations after eachother. We use the term in Unreal dev so... :D

    ...anyway, awesome, I'll dive into your Ladder code and check for myself!

    I love Mecanim! As I said I've rolled my own involved anim controller and works great, but there are specific things I like that your tool does such as a solid 'isGrounded' implementation, smoothing and reduced latency on checks. Since your tool already does so much of what I need, I can add double-jumps or jetpacks, diving rolls and what not...or at least I hope I can!

    Now typing all that, I just realized I have another questions:

    • As odd as this may sound, say I was unable to sufficiently get my new animation sequences :p in and coded with specific behaviors I need, is it possible to have my 'own' anim controller component work in conjunction with MC? I can try to elaborate if this doesn't make sense...
    Thank you so much Tim!!

    Ciao

    -Steven
     
    Last edited: Apr 7, 2016
  38. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    No. I can't think of anything. With the blend-trees I've done, I've just used the InputY parameter. It may be that my blend-trees just weren't sophisticated enough.

    The MC manages a set of parameters. So far, I've been able to do everything with this set. You can certainly add more if needed, but you'd manage those (as you said).

    My general answer is yes. The only requirement I would say is that you don't want two systems trying to control Mecanim at the same time.

    Other than that, think of each motion like a mini-monobehaviour... It has an activate, update, deactivate, and several other functions to support the life-time of that motion. You can do anything you want in those.

    You may have specific requirements with your controller component, but in general I don't see why they couldn't work together.
     
  39. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    One more thing regarding the MAP Motions importing video I just finished watching...

    ...you're showing how to import the MAP asset package and then creating the Sub-States in Mecanim. I don't want to use MAP at all, so what I was asking was how you do it from scratch?

    I already have my large set of animations I created ready to go, so do I simple remove your animations from the project and assign mine to the existing MC setup?

    Perhaps better, create my own and cut and paste everything from your default controller, code and all into mine as if I were creating brand new sequences from scratch? (referencing this video ). Is that how you initially inserted MAP into your projects?

    Thanks Tim

    -Steven
     
  40. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    You can go about it a couple of ways...

    1. Simply replace my animations with yours. This works, but only if your animations match mine. For example, the WalkRunPivot uses a walk-loop... replacing that is pretty easy. But, it also uses several pivots and stops. You may not have those.

    2. Starting clean (like the video you linked to) may be the best approach.

    For the MAP motions, I started with a new sub-state machine and added the Mecanim flow and animations. Then, I copied the MotionTemplate.cs file and customized it to work with the sub-state machine how I wanted.

    Between the videos and the Motion Builder's guide, they will walk you through it.
     
  41. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Sweet!

    I very much appreciate all the time you took, thank you!!

    -Steven
     
    kurotatsu and Tryz like this.
  42. AiryKai

    AiryKai

    Joined:
    Apr 16, 2014
    Posts:
    52
    btw, @Tryz, have you thought about the possibility of adding the avoidance of dynamic obstacles for NavMeshInputSource? Standard NavMeshObstacle does not work if set on another NPC character...
     
  43. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I think dynamic avoidance is something that should be handled by the path-finding solution. The NavMeshInputSource is just getting a point from the solution and moving to it.

    With the NavMeshInputSource, I'm showing how to integrate the MC and use the path information to drive the character. Hopefully people can adapt it to what ever path-finding solution they are using. The MC and input source can't really determining if the path is right or what to avoid.

    I haven't looked into Unity's solution for moving obstacles like NPCs. That seems like a pretty common thing. So, I'd hope they have a solution for that. But, I think the NavMeshInputSource would just use the points given and not determine the path.

    Probably more long winded than you needed. :)
     
  44. AiryKai

    AiryKai

    Joined:
    Apr 16, 2014
    Posts:
    52
    @Tryz OK, I just assumed that you have already resolved this issue :)

    Another question... Is there any easy way to force NPC to use WalkRunPivot motion for movement?
     
  45. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Sure, just use that in your NPC's motion list.

    For example:
    1. Open the MC_NavMesh demo and click on Jones.
    2. Go to the Advanced tab and uncheck "Walk Run Strafe"
    3. Check "Walk Run Pivot".

    Now he'll use that motion when the NavMeshInputSource passes movement information through.

    I just tried it. :)
     
  46. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    Hey Tryz, have you ran into the issue where Motion Controller will just stop taking directional movement input? I meant to post about it awhile go but I've never been able to recreate it on demand, sometimes it goes away for a bit and sometimes it happens immediately. Basically, if you open up the Labs scene and bounce the input with the left stick on an Xbox 360/One controller forward and backward, the rig locks up. It will get camera rotation but the character will not move until the scene is restarted. Looking at the Animator for the scientist, it's just running the IdlePose state. I usually just do it by flicking the stick forward and back at random speeds or even just pressing forward a few times quickly after starting the scene. I just ran into it again but now I'm actually using my own characters/scenes so it's becoming more of a problem. Unity Pro 5.3.4f1. This happened in the last version of Unity and MC as well.

    Another thing: The Rewired Input Source and guavaman's prefab need to be updated. I'll post one if I work it all out before someone else does but it's pretty broken now.
     
  47. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    No, I haven't seen or heard of this one.

    It's 10:30 pm here. I'll try what you mention in the morning (I use a wired Xbox 360 controller).

    What input source are you using... Unity or Rewired? What motion are you using for movement (i.e. WalkRunPivot)?
     
  48. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    I'm literally just creating a new project in Unity, importing only Motion Controller v2 2.16, opening that Labs demo scene and hitting Play to do this. Both the 360 and Xbox One controllers are wired, Windows 10 Pro.

    edit: Opening Animator side-by-side with the Game running and it's still getting the Inputs from the controller(the Parameters change when the stick moves) when I lock up the character but the Animator doesn't change states anymore.
     
    Last edited: Apr 15, 2016
  49. dl_studios

    dl_studios

    Joined:
    Oct 14, 2012
    Posts:
    76
    Hi @Tryz, I've been working with the latest Motion Controller. Couple questions.

    1. Is it possible to have the Motion Controller not controlled by root motion? I'd like the motion controller to be as responsive as the actor controller is in it's demos and less constrained by animation. My game is more cartoon like so run, jump and land don't need realistic movement. That said, I wouldn't mind keeping root motion for the ledge climbing. Is it possible to have some movements handled by root motion and others handled by actor physics?

    2. I'm trying to use a different camera than one provided with motion controller. However, when the character controller falls or jumps it jitters. I've toggled on Extrapolate on the Actor Controller but that still didn't do the trick. I've tried updating the camera collision detection and movement in LateUpdate, and FixedUpdate and I've also tried it in the lController.OnControllerPostLateUpdate, but to no avail. When the character falls it jitters. Are there other things I should be looking at?

    3. Also, I own the Adventure Camera and decided to give that a try and imported it. I must have done something wrong because my project broke after that. Is there a certain order or technique with which motion controller and Adventure Camera need to be imported? I imported the both of the latest versions of the asset.

    Thank you for the help and for making these assets.
     
  50. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Yes. In each motion is a function called UpdateRootMotion(). You can override the rMovement and rRotation parameters to add, remove, or modify the animation's root-motion for the frame.

    In this way, you can customize exactly when and how you use root-motion.

    If I had to guess, the jitter is probably from the camera having its position updated before the AC updates its position. It's more a visual artifact than a true position issue.

    Most cameras typically change position during LateUpdate. However, I also use LateUpdate to update the character's position in order to position correctly on moving platforms. So, my cameras tap into OnControllerPostLateUpdate() in order to ensure the camera always updates after the character controller as Unity by itself won't guarantee update order.

    So, you have two options:

    a. Have your camera also tap into OnControllerPostLateUpdate() and do its positioning there. Just check out any of my cameras (FollowCamera.cs is a good one) to see how I do it.

    b. Uncheck the AC's "Use LateUpdate" option. Now the AC and MC will update in Update() and not LateUpdate(). Just be aware this could cause issues with moving platforms.

    Odd. No certain order to import or anything. They just work together out-of-the-box.

    I'm using them together now. I also just created a new project, imported the MC, and imported the ACR... all is good.

    Feel free to email the error to tim@ootii.com. Maybe there's a collision with some other camera asset not using namespaces? That is becoming more common as some asset developers aren't using coding standards.