Description
The IsTrigger
property of the PhysicsShape
class indicates whether the shape is a trigger. A trigger is a special type of collider that does not cause physical collisions but can be used to detect when other objects enter or exit its volume. This property is a boolean value, where true
means the shape is a trigger, and false
means it is not.
Usage
To use the IsTrigger
property, you can get or set its value to determine or change whether the PhysicsShape
acts as a trigger. This can be useful for creating areas that detect when an entity enters or exits without causing a physical response.
Example
// Example of setting a PhysicsShape as a trigger
PhysicsShape shape = new PhysicsShape();
shape.IsTrigger = true; // Set the shape to be a trigger
// Example of checking if a PhysicsShape is a trigger
bool isTrigger = shape.IsTrigger;
if (isTrigger)
{
// Perform actions when the shape is a trigger
}