Remove rigidbody component

I am trying to disable the rigidbody constraints on my project on the click of a button, but I’m havbing a bit of trouble.

So far this is my code:

var constraints : RigidbodyConstraints;

function Update () {
	if(staticvar.cleardisc == true) {
	print("working");
		constraints = FreezeNone;
	}
}

So the code does print “working” which means the static variable is fine, however I’m not sure what I should write to make all the constraints disappear. I’ve tried constraints = false and constraints = 0 too but it didn’t help me

Any help would be appreciated :slight_smile:

You’re looking for

constraints = RigidbodyConstraints.None;

However, if you are trying to remove the Rigidbody altogether (as the title suggests), you should use

Destroy(rigidbody);