bool X { get; set; }

robot_2Generated
code_blocksInput

Description

The X property of the PhysicsLock struct is a boolean value that determines whether the physics simulation for an object is locked along the X-axis. When set to true, the object will not move along the X-axis, effectively constraining its movement in that direction.

Usage

Use the X property to control the movement of a physics-enabled object along the X-axis. This can be useful in scenarios where you want to restrict an object's movement to certain axes, such as in a 2D game where movement is only allowed along the Y and Z axes.

To lock the X-axis, set the property to true. To allow movement along the X-axis, set it to false.

Example

// Example of using the PhysicsLock struct to lock movement along the X-axis
PhysicsLock lockSettings = new PhysicsLock();
lockSettings.X = true; // Lock movement along the X-axis
lockSettings.Y = false; // Allow movement along the Y-axis
lockSettings.Z = false; // Allow movement along the Z-axis

// Apply the lock settings to a physics-enabled object
GameObject myObject = new GameObject();
myObject.PhysicsLock = lockSettings;