bool EnableTouch { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The EnableTouch property of the PhysicsBody class is used to enable or disable touch callbacks on all PhysicsShapes associated with this physics body. When set to true, it allows the physics engine to trigger touch events for any of the shapes that are part of this body. The property returns true if any of the physics shapes have touch events enabled, otherwise it returns false.

Usage

To use the EnableTouch property, simply set it to true or false depending on whether you want to enable or disable touch events for the physics shapes of the body. This can be useful for detecting collisions or interactions with other physics objects in the scene.

Example

// Example of enabling touch events on a PhysicsBody
PhysicsBody myPhysicsBody = new PhysicsBody();
myPhysicsBody.EnableTouch = true;

// Check if touch events are enabled
bool isTouchEnabled = myPhysicsBody.EnableTouch;
if (isTouchEnabled)
{
    // Handle touch events
}