- Home /
How can you disable a RigidBody?
I have a gun that can be picked up. Because it has a RigidBody it falls as soon as you equip it. How can you disable it or prevent it from falling. I tried
var Gun : RigidBody
function PickUp ()
{
Gun.active = false;
}
Comment
Answer by Crystalline · Oct 31, 2013 at 12:33 PM
This should do it!
var Gun : GameObject;
function PickUp()
{
Gun.rigidbody.isKinematic = false;
}
for not thinking
rigidbody.enabled = false;- I'm not sure why, but therigidbodydoesn't haveenabledon it. And if you tryrigidbody.active = false;that will actually disable the gameObject that the rigidbody is attached to.
So you either set is$$anonymous$$inematic to true, or nuke the whole component if it's not needed anymore: Destroy(target.rigidbody);
Your answer