Collisions and triggers

To detect physical interactions between game objects, the most common method is to use a collider component—an invisible net that surrounds an object's shape and is in charge of detecting collisions with other objects. The act of detecting and retrieving information from these collisions is known as collision detection.

Not only can we detect when two colliders interact (collision detection), but we can also detect when particular colliders are intersecting (trigger-mode collision detection) and even pre-empt a collision and perform many other useful tasks by utilizing a technique called Ray Casting. Ray casting, in contrast to detecting intersecting 3D shaped colliders, draws a Ray—put simply, an invisible (non-rendered) ...

Get Unity 3.x Game Development Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.