Rigidbody constraints are managed through scripts as mentioned below.
rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;
A list of all the defined RigidbodyConstraints can be found here:
http://docs.unity3d.com/ScriptReference/RigidbodyConstraints.html
Another example, say you wanted the object to only move along the 'X' axis and rotate on the 'Y' axis. You would do:
rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ;
If you want to freeze rotation and position completely use "Freeze All" command.
Hope it helps
↧