PhysicsLock Locking { get; set; }

robot_2Generated
code_blocksInput

Description

The Locking property of the Rigidbody class is used to control the locking state of the rigidbody in the physics simulation. It determines which axes of the rigidbody are locked, preventing movement or rotation along those axes. This can be useful for simulating constraints or fixed objects in a scene.

Usage

To use the Locking property, you can set it to a value of type PhysicsLock, which specifies the axes to lock. This property is not static, so it must be accessed through an instance of the Rigidbody class.

Example usage:

Rigidbody myRigidbody = new Rigidbody();
myRigidbody.Locking = PhysicsLock.PositionX | PhysicsLock.RotationY;

In this example, the rigidbody is locked along the X-axis for position and the Y-axis for rotation, meaning it cannot move along the X-axis or rotate around the Y-axis.

Example

Rigidbody myRigidbody = new Rigidbody();
myRigidbody.Locking = PhysicsLock.PositionX | PhysicsLock.RotationY;