I am developing 2d platformer and I've faced with a very strange triggers behaviour in Unity. I have made the enemy that can throw objects into main player. So I have made two empty GameObjects with Circle2D colliders on them and attached them into the enemy GameObject. The first trigger ensures that when enemy hand will pass through it, it will spawn an object that will be thrown in future, and the second trigger is responsible for the throw that object into player. The first trigger ensures that when the enemy's hand will pass through it, it will spawn an object that will be thrown in future, and the second trigger is responsible for throwing an object into main player. Every trigger has a Rigidbody2D component attached to it. The hands of the enemy have tags "right hand" and "left hand" and I am checking the in the OnTriggerEnter2D method. This method is calling and I have log messages and this method is detecting that left or right hand are entering trigger. But the problem is in that this method is calling when the hand has already passed through trigger and get out of its bounds. Can anyone help me and explain why this is happening? I have attached a picture where I draw a scheme and described my problem.
Asked
Active
Viewed 87 times
1
-
1You may find more users that can help you on `gamedev.stackexchange.com`, although it is entirely possible that your object has moved in the time it has taken for the event to be triggered – Sayse Sep 22 '14 at 08:53
-
Thank you, Sayse! I'll try to ask my question on gamedev.stackexchange.com – bukka.wh Sep 22 '14 at 09:34