Introduction to Physics in Unity

Using in physics in unity is done through applying the component “Rigidbody” to your game component. With this attached it will be able to respond to gravity and be able to collide with other game objects.

Rigidbody component

To help with the collision of two objects you also add a collider. this can be a box, capsule and other types

Collider component

“is Trigger” will be used to trigger an event like destroy enemy or laser which is then ignored by the physics engine.

here we can see the laser collide with the enemy and both game objects destroy it self.

using the monobehaviour class OnTriggerEnter we can make the above action happen. Here it checks the “other” gameObject it has collided with

like the laser we can add another function to damage the player.

--

--

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