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.
To help with the collision of two objects you also add a collider. this can be a box, capsule and other types
“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.