- Home /
How to maintain Mecanim generic root motion velocity from one state & clip to another with no actual root motion.
I have a quadruped that 'bounds' as its run (leaves the floor each 'step') and uses root motion. Using an anim clip event, I am ray-casting at the peak to determine whether the landing will actually land on something. If it will, I continue the clip. If not, I rapidly transition to a falling state which uses velocity to ray-cast for when to revert to the landing animation. The problem is my falling animation has no actual root motion -- it is stationary and falls under gravity on the rigidbody on the game object. The problem is that forward velocity seems to be automatically tweened from the bound clip's velocity (about 2m/s) to the fall clip's velocity (0) so as soon as I detect falling should happen, the animal comes to an abrupt halt mid-air then falls gracefully down! (the gravity-based fall is working fine)
- I am using a Blend Tree for the run. 2 layer nested 1D tree same as the mecanim sample (AI teddy in a maze). 1'st controls walk/run, 2'nd controls steering. As yet, there are no 'walk' motions and the speed is fixed at 1 = run.
I am using "Animate Physics".
Culling mode is currently set "Always animate".
It has a Capsule Collider with a frictionless physic material.
The fall clip is actually a single frame atm (the same as the peak of the bound). That'll change in time.
The "Motion | Root motion node" setting for the clip is "None".
The fall clip has all movements baked into pose (which I thought removed the effect of root motion, right?)
I've tried with and without looping on the fall clip.
Its Rigidbody has "Use gravity" set but not "Is kinematic". It also has "Freeze Rotation" set on all axes.
Attempting to work-around, I've tried recording the rigidbody's velocity at the peak before ray-casting (the value looks fine) then assigning back to itself from various places while transitioning. This doesn't seem to work. I tried from a StateMachineBehaviour's OnStateUpdate() and a MonoBehaviour's FixedUpdate() (repeated). When it's assigned over several frames, I just seem to freeze the object in the air -- obviously gravity doesn't affect -- but it doesn't move forwards either!?
I've included screenshots of the two clips below, 1'st bounding, 2'nd falling.
Hopefully I'm doing something dumb! I'm happy to provide more details etc. Thanks in advance!
Did you ever find an answer to that? I get the feeling we will have to do it manually through a State $$anonymous$$achine Behavior or on Animator$$anonymous$$ove.
Your answer
Follow this Question
Related Questions
How does the Animator drive Rigidbody with root motion (in detail)? 1 Answer
Player with Rigidbody gravity and root motion bobs up and down into the terrain 0 Answers
[mecanim]: BindSkeleton: cannot find ...? How to fix it? 0 Answers
MecAnim Root Motion - How To Prevent It 2 Answers
Mecanim is really really annoying!! 0 Answers