- Home /
Fire Collision detection
I want my character to be able to walk but sometimes there's fire in the way which should hurt him and now I'm wondering how. More specifally, how do I detect collision between my player (or my players collider) and the fire particles?
I could perhaps check for particle collision but I want to make the game as lightweight as possible (it's a mobile game) or I also tried putting an invisible collider in the middle of the fire but then my character can't walk through it which should be possible
What is the best practice? And how do I achieve this in terms with triggers, colliders etc?
I explained it a bit more now, but that's all there is to explain actually
Answer by Lost_Syndicate · Jun 02, 2018 at 09:43 PM
Use Ontriggerstay, and do something like health -= 1 * Time.deltatime, or you can start a couratine, wich repeats itself and uses a WaitIfStatement.
also use a if (other.tag == "Player"){} using OnTriggerStay(Collision other) (it might not be collision, i rarely use triggers.)
Your answer
Follow this Question
Related Questions
Fade texture on collision/trigger with certain tag or layer? 2 Answers
Collisions - bounce of walls but not from characters (while still reacting with them) 0 Answers
Something wrong with destroying script 0 Answers
Extracting child trigger from compound collision 0 Answers
Trigger2D not working 0 Answers