- Home /
2D - Two objects, each having two trigger colliders - interacting
Hello,
so, I have one enemy object that has two trigger colliders, one used as a range to determine whether my player has entered the zone, and one to determine if it was hit by the player's sword and absorb the damage accrodingly. And second object(my player), also has two colliders, one attached to the sword and one to take the damage(whether my player was hit or not).
What I am generally trying to do is: I want my player once enters the zone, to trigger the enemy. My enemy has to wake up from his Idle state and start walking towards my player ,even if my player jumps over the enemy, it must flip and follow my player and try to hit the player. The enemy has sleep animation as well, once my enemy exits the bigger trigger zone, the enemy needs to go asleep.
The problems: If my player stands right at the edge of the Big trigger zone, the enemy wakes up, the animation starts, but it doesn't move. Once my player tries to jump over and touches the 2nd collider, my enemy instantly goes to sleep mode, I presume there is a problem that I have two trigger colliders. I already tried tags and collision type detectors but it seems I am doing some mistakes, please find attached my scriptand if anything else is needed please do tell. I would really appreciate any kind of help. Thanks and best regards.
Your answer
Follow this Question
Related Questions
How come people prefer to use rays for 2d collision instead of edge colliders? 1 Answer
Problem with method Collider2D.isTouchingLayers() 4 Answers
Audio trigger when FPS walks into things, walls, doors etc 0 Answers
2D collision won't work? 2 Answers
Does OnTriggerStay don't detect a collision with a non-trigger collider? 1 Answer