Description
The Touching
property of the Rigidbody
class provides a list of all the trigger colliders that the rigidbody is currently in contact with. This property is useful for determining which triggers are being interacted with by the rigidbody at any given time.
Usage
To access the Touching
property, you need to have an instance of a Rigidbody
component. You can then iterate over the collection of Collider
objects to perform operations based on the triggers the rigidbody is touching.
Example
// Assuming 'rigidbody' is an instance of Rigidbody
foreach (var collider in rigidbody.Touching)
{
// Perform operations with each collider
// For example, log the name of the collider
Log.Info($"Touching collider: {collider.Name}");
}