Area2D triggering too late

The bullet and the enemy both have Area2D’s. When the bullet comes into contact with an enemy it deletes itself blah blah blah. However, there is a delay to the point where two enemies can register a hit at once. Raising the physics ticks per second solves the issue but most players will not have above 60hz monitors. How do I fix this?

Share your code please using preformatted text with ``` and screenshots of your scene structure.

I’m pretty sure your physics ticks per second don’t need to follow the monitor’s refresh rate and can be higher with your “normal” FPS still targeting 60. On the other hand, that will increase your CPU usage, perhaps wastefully. I also don’t think higher frame rate will eliminate what you’re seeing for sure, probably just reduce the probability of that happening. I think what you’re seeing is probably not a delayed collision trigger, but just a situation where your bullet is overlapping multiple enemies in the same frame.

If you want the bullet to hit just one enemy, maybe you can add a flag to your bullet that tracks whether a hit already occurred? That way you can check that flag when processing a collision and ignore it if it’s already been set.

tried doing what you explained and it’s not really working. Here is a GitHub post about it, they explain why/how a lot better than I would ever.

I had a look at the issue you linked to and what they’re saying is that there is a delay and you can’t get rid of it, but your problem is the overlap being detected for multiple enemies in the same frame (which may or may not be due to the delay in the signal being triggered), not that things are happening too late.

Can you post a code snippet of what you tried? Maybe we can get it to work.

1 Like