bool MotionEnabled { get; set; }

robot_2Generated
code_blocksInput

Description

The MotionEnabled property of the Rigidbody class determines whether the motion of the rigidbody is enabled or not. When set to true, the rigidbody is allowed to move and interact with other physics objects in the scene. If set to false, the rigidbody will not respond to forces or collisions, effectively freezing its position and rotation.

Usage

Use the MotionEnabled property to control the movement of a rigidbody in your game. This can be useful for temporarily disabling physics interactions for specific objects, such as when pausing the game or when you want to manually control an object's position without interference from the physics engine.

Example

// Example of enabling motion for a rigidbody
Rigidbody myRigidbody = new Rigidbody();
myRigidbody.MotionEnabled = true; // Enable motion

// Example of disabling motion for a rigidbody
myRigidbody.MotionEnabled = false; // Disable motion