How it works...

In this recipe, we attach triggers (game objects with Box Collider components set to Is Trigger) as child objects of our trap's moving parts. The OnTriggerEnter() method in our DeathTrap.cs script is called whenever an object with a Rigidbody component enters one of our trigger objects. It does not matter if the object or the trigger is moving. The animation of the moving parts of our trap also moves the child trigger objects. You can use it to create some really spectacular traps in your games.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.73.127