Hello,
I want to calculate the speed of a sphere that is rolling down a terrain.
I used rigidbody.velocity.magnitude for it.
But when the sphere is rolling down the terrain the speed is always 0?
When I manually add a force to the sphere I get a magnitude value but its always something like 0.0000632 and its jumping up and down, even if the sphere is getting continiously faster.
Any Idea? Thanks =)
My guess is that, since the sphere rotates, the fact you’re using ‘Vector3.forward’ is causing a problem.
I believe you should use ‘transform.forward’ so that the sphere actually receives a forward force all the time. Otherwise, after half a rotation, the initial forward force gets neutralized.
If you instead need cardinal directions, you’ll need to use http://unity3d.com/support/documentation/ScriptReference/Transform.InverseTransformDirection.html