Animator Motion

Flamehead

Member
Are there any examples inside the demo that use the animator motion logic?


I'm wanting to create a predictive jumping animation. I have the logic to get the position & rotation of the point needed to jump to, but I'm not sure how to set up the ability and the logic needed inside the script. I'm not sure what all is needed to get the character to update its position & rotation following the animator's motion scriptable object with variable distances and rotations. The character won't just move the same amount of distance or rotation during gameplay so it needs to be adaptable if that makes sense.

Could you help layout what I would need to get this to work?
 
In the demo scene the walk through door ability will use the motion if in a first person perspective.
 
In the demo scene the walk through door ability will use the motion if in a first person perspective.
What variables would I need to reference in my ability script to update the character's position and rotation while it is using the animator motion curve logic?
 
The animator motion is a set of predefined animation curves that the character follows when it is assigned to an ability. The ability will evaluate the animation curves, and set the position accordingly, so you don't have to do anything for moving the character. But you probably have to dynamically change the animation curves when the ability starts, as you want to land on a pre-defined spot. On ability start, you can get a reference to the scriptable object, and set the animation curves accordingly. Then the character will follow these curves.
 
The animator motion is a set of predefined animation curves that the character follows when it is assigned to an ability. The ability will evaluate the animation curves, and set the position accordingly, so you don't have to do anything for moving the character. But you probably have to dynamically change the animation curves when the ability starts, as you want to land on a pre-defined spot. On ability start, you can get a reference to the scriptable object, and set the animation curves accordingly. Then the character will follow these curves.
That is helpful! Since these curves are driving the capsule rather than the mesh, how do we get the rotation curves to affect the character mesh? I noticed that the rotation curves weren't doing anything so I assume it is because they are only moving the capsule collider?
 
The animator motion does not move the capsule, but the character itself. For the animator motion to be effective, you have to disable root motion position and rotation for your ability.
 
The animator motion does not move the capsule, but the character itself. For the animator motion to be effective, you have to disable root motion position and rotation for your ability.
I have disabled both root motion position and rotation and I'm still not getting my character to rotate. What else could it be?

Is there any way to make the curves respond logically in meters? If I add a curve on the position y axis that goes from (0,0 seconds) to (1,1 second), my character would move up 1 meter over 1 second. Is this possible? I don't really understand the y axis. X axis is obviously time but the y is confusing.
 
Last edited:
If I add a curve on the position y axis that goes from (0,0 seconds) to (1,1 second), my character would move up 1 meter over 1 second. Is this possible?
No, the y axis is the delta value. If you are using the Update loop then it is framerate dependent. You can see how it works within Ability.OnAnimatorMove:

Code:
                var deltaRotation = m_CharacterLocomotion.AnimatorDeltaRotation;
                m_AnimatorMotion.EvaluateRotation(Time.time - m_StartTime, ref deltaRotation);
                m_CharacterLocomotion.AnimatorDeltaRotation *= deltaRotation;
 
Top