Question by
$$anonymous$$ · Nov 22, 2019 at 01:08 AM ·
collisiontriggerexplosion
How to explode an object when it touches a trigger?
I have no code written as it keeps not working but I need to make it so when a player (With the tag "Player") touches a trigger, an object I connect the script explodes. No sound needed. Thanks for the help in advance!
Comment
Best Answer
Answer by lgarczyn · Nov 23, 2019 at 04:49 AM
Create an OnTriggerEnter function in a script on the object with the trigger collider. Inside that function, check that the collider that entered the trigger (your argument) had the tag "Player". If it does, explode.
Your answer
Follow this Question
Related Questions
How to detect collision of two moving characters? 1 Answer
How to move and rotate to other direction when hitting a wall 1 Answer
How to make a growing mesh 0 Answers
Trigger not detected 0 Answers
On Trigger Enter working at random 0 Answers