bool MotionEnabled { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

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

Usage

To enable or disable motion for a Rigidbody instance, simply set the MotionEnabled property to true or false as needed. This can be useful for temporarily pausing physics interactions or for objects that should remain static under certain conditions.

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