0
\$\begingroup\$

I have a character with a run animation. The animation was downloaded from mixamo.com. In the animation controller, the physical update mode is selected. How do I change the speed of an animation based on the speed of a rigid body?

\$\endgroup\$
0
\$\begingroup\$

You need a Blend Tree.

In your Animator controller create a speed parameter as float and create Blend Tree. enter image description here

In your Blend Tree, add motions and select your animations. (Image is from example 2D Blend Type, you can choose 1D if that's what you need). Numbers in Pos Y is max speed, if speed goes above then you may want to transition into another animation.

Example image of Motions in Blend Tree

Choose Blend Type and Parameters (in Blend Tree) as in this case parameter is SPEED_VARAIBLE. Examples of parameters in Blend Tree

GetComponent<Animator>().SetFloat(ANIMATOR_KEY, SPEED_VARAIBLE);

Here's the link to documentation https://docs.unity3d.com/Manual/class-BlendTree.html

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .