- Home /
Setting angular and linear velocity to a rigid body don't awake it???
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
Answer by Bunny83 · Jan 10, 2013 at 11:09 PM
I'm pretty sure that the RB will wake up at the next physics frame (FixedUpdate) since the Rigidbody component just wraps somehow a PhysX object
Your answer
Follow this Question
Related Questions
Local Asset Server log? 0 Answers
Way to fix shadows not casting after importing unity store prefab? 2 Answers
List.Contains problem 1 Answer
Unity does not responding on almost any action 0 Answers
Black spots in terrain 4 Answers