bool MotionEnabled { get; set; }

robot_2Generated
code_blocksInput

Description

The MotionEnabled property of the PhysicsBody class controls whether the physics simulation is active for this body. When set to true, the physics engine will simulate motion for the body, allowing it to move and interact with other physics objects according to the laws of physics. When set to false, the body will not be affected by the physics simulation, effectively freezing it in place.

Usage

To enable or disable motion for a PhysicsBody, set the MotionEnabled property to true or false respectively. This can be useful for temporarily pausing the physics simulation for a specific object without removing it from the scene.

Example

// Example of enabling motion for a PhysicsBody
PhysicsBody myPhysicsBody = new PhysicsBody();
myPhysicsBody.MotionEnabled = true; // Enable motion

// Example of disabling motion for a PhysicsBody
myPhysicsBody.MotionEnabled = false; // Disable motion