Collision vs Triggers: in Unity

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.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store