Collision vs Triggers: in Unity

Sudarshan Thube
Nov 17, 2021

--

I setup small scene with some blocks and spheres. i added Rigidbody component to spheres. if we do not add Rigidbody then sphere will pass through the blocks without stopping and without any collision.

We will see how to use triggers in collision,

We activated is trigger event in one of the blocks.

To communicate with collisions in script without using Trigger we need to use OnCollisionEnter2D(collision2D) or OnCollisionEnter(collision) and when we use Trigger then we need to use OnTriggerEnter2D(collider2D) or OnTriggerEnter(collider).

In next article we will see how to use these in our project.

--

--

Sudarshan Thube
Sudarshan Thube

No responses yet