Description
The EnableTouch
property of the PhysicsShape
class controls whether the shape can trigger touch events for its owning entity. When enabled, the shape can fire events such as Entity.StartTouch
, Entity.Touch
, and Entity.EndTouch
, allowing for interaction detection with other entities.
Usage
To use the EnableTouch
property, simply set it to true
or false
depending on whether you want the shape to trigger touch events. This can be useful for implementing interactive elements in your game, such as buttons or triggers that respond to player interaction.
Example
// Example of enabling touch events for a PhysicsShape
PhysicsShape shape = new PhysicsShape();
shape.EnableTouch = true; // Enable touch events
// Example of disabling touch events for a PhysicsShape
shape.EnableTouch = false; // Disable touch events