Unity 2023.2: Introduction to 2D: Part 7: Collision System and Responding to Collisions

Опубликовано: 12 Октябрь 2024
на канале: Dan Cox
47
0

This video demonstrates how collider components (box and circle) work with a rigidbody component. By giving a game object mass (via a rigidbody component), the physic system in Unity will prevent the body and collider after the initial overlap begins.

In C#, a collision can be detected using the OnCollisionEnter2D() method. This method is given the collision event, including the incoming and current game object.

This video also showed a "hit box." In game design and development, the collider can extend away from a shape. Because the physics system only reacts to to the body and collider, the shape itself is not part of any calculations.

Unity 2023.2: Introduction to 2D Playlist:    • Unity 2023.2: Introduction to 2D  

Created by Dan Cox ( @DanCox )