Animation speed

Hi , I need to make the animation speed of my character independent of the frame rate. I have tried : animation[“latigo3”].speed = Time.deltaTime; but my animation runs slower whe the frame rate is higher.

Hope somebody could help me

htwarrior

animation playback speed is already independent of frame rate thus, don’t modify the animation speed variable at all and it will work fine.

But I observe that my animations runs slower in when I have more frame rate.My models have a rigidbody attach with the isKinematic property checked and no gravity . My world has a scale of 1 and my models of 160 . Is this the problem?

htwarrior

Doesn’t sound like that would cause a problem. Maybe some scripts still modify the playback speed? Maybe it just looks like it slows down, but it’s really just a lower frame rate? By how much does it slow down?

Hi, I need to modify the speed of the animation of my model proportional to its velocity.How can I do this in a frame independent way?

thanks
htwarrior

Animation playback is always frame rate independent.

To make it eg. twice as fast you write:

animation["theAnimation"].speed = 2.0;
function Update ()
{
   var speed = rigidbody.velocity.magnitude;
   animation["theAnimation"].speed = speed;
}

The Mathf.InverseLerp function is a useful utility function for remapping speed. In the Character Animation example project there is also an example that modifies the playback speed of run / walk cycles for the character.

Thanks I got the idea

HTwarrior