turning on and off rigidbodies?

Hello,
I was wondering if there is a way to turn on and off rigidbodies of an object using javascript so that when a rigidbody gets turned off, the original position and rotation of that object will stay the same until it gets turned back on again and then gravity and physics will take effect on it again.

Thank you,
Michael S. Lowe

You can do set the rigidbody to be kinematic by setting rigidbody.isKinematic to be true to ignore physics. Another way is to disable to collider and set the rigidbody to not use gravity.

Remember to ask for the rigidbody first to avoid any null reference errors. :smile:

if(rigidbody) {
  rigidbody.isKinematic = false;
}

You can also freeze position and rotation on the rigidbody.

That way you can still detect collision events.