I’m working in my game’s pause. I can’t use the Time.timeScale = 0 trick because I use a 3D ingame menu pause, so to stop a thrown rigid body I use this code:
rigidbody.useGravity = false;
mVelocity = rigidbody.velocity;
mAngVelocity = rigidbody.angularVelocity;
rigidbody.velocity = Vector3.zero;
rigidbody.angularVelocity = Vector3.zero;
rigidbody.isKinematic = true;
And then to resume game I use this code:
rigidbody.isKinematic = false;
rigidbody.velocity = mVelocity;
rigidbody.angularVelocity = mAngVelocity;
rigidbody.useGravity = true;
The problem is that if I check the object’s state immediately after resume the game, it’s still sleeping! What’s happening? I have even tried to force a rigidbody.WakeUp() with same results. Do I have to wait or something to the rigid body to wake up?
Thanks in advance