Controls which degrees of freedom are allowed for the simulation of this Rigidbody.
// Freeze the rotation around x-Axis rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY;
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void Example() { rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY; } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def Example() as void: rigidbody.constraints = (RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY)