When colliding objects
Fires when the object bumps into something.
Introduction
When Colliding with Objects is an event in the Physics group of World Events. It fires when the object bumps into something. Like every event, it does nothing by itself. It waits for the right moment, then runs all the actions connected to it. Use it for collision reactions: a thud and dust when a crate lands, a clatter when barrels topple into each other. This event belongs to the Physics component. Open the Physics component guide to see everything the component itself can do. Collision is about solid contact, while zones are about open space: compare this event with When Trigger Entered and When Trigger Exited to decide which fits your mechanic. Impact damage usually flows into the health family, starting with When Health Decreases , and the physics behavior of the object is configured in the Object Logic guide. When colliding objects event in the Uni editor Image The When colliding objects event in the Script Editor.
Parameters
Object the object this one collided with Parameter Description
How to Access
How to Access - Event When colliding objects
How to Use
Select the object, press Propertie (the blue equalizer icon) in the bottom action menu, and scroll to the bottom of the properties panel. Press Add Component and pick the Physics component; its block stacks below the existing properties with the When Colliding Objects event inside it. Press the + button below the event to add a script, then press Edit on that script to open the script editor and build the actions that should run when the event fires. Press Play and let the object collide with another object, then check that the actions run.
Example
When colliding objects: Execute System.Environment.Play Spatial Audio Audio Position X 0 Y 0 when-colliding-with-objects-example.png Plays a spatial audio cue at the collision position when the object bumps into something. caption
Common Uses
Impact sounds and dust Trigger pressure-style reactions Toppling chain reactions
Tip
Resting contact can re-fire this event as the object settles. Add a short cooldown between reactions to avoid sound spam.