bool IsTrigger { get; set; }

book_4_sparkGenerated
code_blocksInput

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 on an instance of PhysicsShape. Setting this property to true will configure the shape to act as a trigger, allowing it to detect overlaps without affecting the physical simulation.

Example

// Example of setting a PhysicsShape as a trigger
PhysicsShape shape = new PhysicsShape();
shape.IsTrigger = true;

// Check if the shape is a trigger
bool isTrigger = shape.IsTrigger;
if (isTrigger)
{
    // Perform actions when the shape is a trigger
}