Why doesn't my rigidbody stop?
Hello, I'm making a 3D tanks game. I want my tank to respawn (teleport) to certain point on map when it's health goes to 0. And I want it to be still. I use this function:
public void TakeDamage(int damage)
{
currentLife -= damage;
if (currentLife <= 0)
{
currentLife = maxLife;
transform.position = new Vector3(350f, 34f, 250f);
transform.rotation = Quaternion.identity;
rb.velocity = Vector3.zero;
rb.angularVelocity = Vector3.zero;
}
tekst.text = "Health: " + currentLife.ToString();
}
rb is rigidbody of my tank
However, angular velocity rarely becomes zero. When a tank respawns, it still has some angular velocity! If I manually reset angular velocity like this:
void Update ()
{
if (Input.GetKeyDown(KeyCode.Q))
rb.angularVelocity = Vector3.zero;
}
it's all right, tank really stops. Why does my TakeDamage function not work properly? My tank is now one box collider and four wheel colliders, nothing big (it's a car really...).
What am I missing?
Your answer
Follow this Question
Related Questions
Problem with rigidbody 2 Answers
Rigidbody going through Colliders help! 1 Answer
Help converting a character controller script to rigidbody 1 Answer
Determine the direction an object is actually moving? 0 Answers
Player movement help! 0 Answers