- Home /
What is an accurate way to determine the velocity of a root motion animation?
Before the days of Mecanim, I would calculate a character's movement speed using rigidbody.velocity and be able to get a fairly accurate speed for walk, run and other movement states. With root motion however the values that rigidbody.velocity returns fluctuate quite erratically. Almost during every recording, the max velocity value is always different despite the test conditions being identical each time.
I have specific velocity values that I would like the character to be at during their walk, run and other movement animations. Eg. walk at 1m/s, run at 3m/s etc. I'm not quite sure what is an accurate way of determining these speeds from root motion. Apart from using rigidbody.velocity the only other way I thought is to time the character moving over a specific distance and do the math. It seems strange though that this would be the most accurate way. Is there a better way to calculate this?