This property provides a list of all the trigger colliders that the Rigidbody
is currently touching. It is useful for determining interactions with other objects in the scene that have trigger colliders.
This property provides a list of all the trigger colliders that the Rigidbody
is currently touching. It is useful for determining interactions with other objects in the scene that have trigger colliders.
To access the Touching
property, you need to have a reference to a Rigidbody
instance. You can then iterate over the collection to check which colliders are being touched.
// Assuming 'rigidbody' is an instance of Rigidbody foreach (var collider in rigidbody.Touching) { // Perform operations with each collider if (collider != null) { // Example: Log the name of the object the collider is attached to Log.Info($"Touching collider on object: {collider.Entity.Name}"); } }