Triggers and Collisions
Learn how to employ triggers and collisions to boost interactivity of the AR experience.
Introduction
Triggers and collisions are two essential concepts in Unity that allow us to detect when objects in our game interact with each other. Both triggers and collisions can initiate an action or an event in our game, such as playing a sound effect or spawning an avatar.
Collisions
Collisions occur when two objects with colliders come into contact with each other. When a collision occurs, the physics engine in Unity calculates the forces and movements between the objects and applies them accordingly. This action allows us to create realistic physics interactions in our game.
Here’s an example setup of Capsule Collider and Rigidbody on a GameObject, ready to interact with its environment using Unity’s physics engine.
Triggers
Triggers, however, are areas in our game that detect when another object enters or exits that area. Unlike collisions, triggers do not apply any physics forces or movements but can be used to trigger events and actions. For example, we could use a trigger to detect when the player enters a particular area and then activate a cutscene or trigger ...