- Home /
Problem is outdated
Rigidbody.velocity giving weird result
The following method, when called in fixed update, prints vector3.zero and zero to the console every second call. Otherwise it prints the correct( or at least expected ) values to the console.
Any clues why?
private void getVelocity()
{
// get the present velocity
currentVelocity = rigidbody.velocity;
// get the speed
currentSpeed = Vector3.Magnitude(currentVelocity);
// last get old position
// oldPosition = transform.position;
Debug.Log("vel = " + currentVelocity);
Debug.Log("spe = " + currentSpeed);
}
PLEASE NOTE: I require the velocity vector for dampening calculation which has not been created yet. I will accept alternatives that give the same vector 3 information.
Also it would be helpful to know if this is reproducible on other systems so I can completely rule out other code interfering.
Thanks.
Follow this Question
Related Questions
What is wrong with this rigidbody? 2 Answers
When I try to save the velocity of a rigidbody and use it later it doesn't work? 1 Answer
Strange/Buggy code behavier 1 Answer
Velocity for movement 0 Answers
C# Rotate velocity issue 1 Answer