bool Enabled { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Enabled property of the PhysicsBody class indicates whether the physics body is active or not. When set to false, the physics body will not participate in collisions, physics simulations, touch events, or trace queries. This can be useful for temporarily disabling a physics body without removing it from the scene.

Usage

To enable or disable a PhysicsBody, simply set the Enabled property to true or false respectively. This can be done at any point in your code where you have access to the PhysicsBody instance.

Example

// Example of enabling a PhysicsBody
PhysicsBody myPhysicsBody = new PhysicsBody();
myPhysicsBody.Enabled = true; // Enable the physics body

// Example of disabling a PhysicsBody
myPhysicsBody.Enabled = false; // Disable the physics body