Reputation: 77
I can't find any information about how many times is OnTriggerEnter2D called. Im making 2D shooter and have a minigun there(fast multiple shoots), the problem is some of the collisions are not recognized, I'm trying if it is cause of small collider of minigun bullet or cause of OnTriggerEnter2D call speed. I mean, when I shoot multiple projectiles with very fast speed on object, does it call OnTriggerEnter2D for new bullet, while last bullet still collide with them? How fast is that? Also i'm not sure if it is better to call triggers for hit on Bullet side or on Player side, which is more efficient.
Upvotes: 1
Views: 138
Reputation: 769
It is more of "where is the bullet now" question rather than the call speed. If your colliders are too small and bullets are too fast, on consequent frames, the bullet might have just skipped the collider. E.g. if collider is 0.5 unit wide, and the bullet is moving with 1 unit per fixed update, the 2 consecutive positions of the bullet could be just in front and behind the collider, never having the chance to be inside the trigger.
Upvotes: 3