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 the motion of the body based on forces, collisions, and other physical interactions. If set to false
, the body will not be affected by the physics simulation, effectively freezing its motion.
Usage
Use the MotionEnabled
property to enable or disable the physics simulation for a specific PhysicsBody
. This can be useful for temporarily pausing the simulation of an object without removing it from the scene or for optimizing performance by disabling physics on objects that do not need to be simulated.
Example
// Example of enabling motion for a physics body
PhysicsBody myPhysicsBody = new PhysicsBody();
myPhysicsBody.MotionEnabled = true; // Enable physics simulation
// Example of disabling motion for a physics body
myPhysicsBody.MotionEnabled = false; // Disable physics simulation