On Trigger Enter with Child colliders (2D)
I would like to test with OnTriggerEnter/Exit if my 2D player is on the floor. And... that works perfectly. Now my player has a child object which also has a trigger collider that I don't want to deactivate. The problem is that my player thinks that he is grounded on the floor even though only the child object is touching the floor. I hope you understand what I mean :/
My question: Can I use OnTriggerEnter/Exit to select which trigger collider I use to test whether I am touching the ground? If I can't, can you tell me how I can solve this?
Answer by Mithri1 · Jan 05, 2020 at 02:57 PM
When you act on dealing with the detection.. Parse all the colliders before acting on any of them. In this case you would then be able to see if only the child is touching the floor. Since I have no way of knowing how you set things up.. use the child objects name.. or store some information in the script of the parent object (just a suggestion)
Your answer
Follow this Question
Related Questions
How to disable a boxcollider2d temporary? 1 Answer
OnTriggerEnter/Exit Rapid Firing? 0 Answers
How to reset player positions after a goal 0 Answers
Change sprite onTriggerEnter2D 0 Answers
Calling Input from another script 3 Answers