Running character according to speed

hi

can any one say how to run character according to speed

regards
santosh

Do you mean have a running animation be effected by how fast the character is moving?

You can change the speed of an animation from a script by doing

animation["animationName"].speed = newSpeed;

Having a speed of 1.0f will play at normal speed, 2.0f will play double speed, etc.

To get how fast the character is going, you could do

rigidbody.velocity.magnitude

And it will give you a float of how fast the character is moving. Multiply this by some number and set it as your animation’s speed and it will play depending on how fast the character is moving.