Disabling rigidbody constraints in code - Freeze Position, Rotation etc

Unity3D 2012. 10. 31. 00:29
반응형

I'm trying to disable a rigidbody contraint to allow movement in the Y axis using javascript. I found the page showing how to do it in the script help files, but when I tried a very minor variation of it, it doesn't work, and I get an error. Here's my line of code:

transform.rigidbody.constraints = RigidbodyConstraints.FreezePositionY = false;

I also tried it like this:

transform.rigidbody.constraints = RigidbodyConstraints.FreezePosition = false;

and this:

transform.rigidbody.RigidbodyConstraints.FreezePosition = false;

None of those work, so simple question - How do I turn off the position freezing in code?



rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY;

반응형
: