Bullet hell without performance hit?

Hello @Baste I hope you don’t mind me asking you a question. If I wanted to make a 2D bullet hell game, would you recommend going with xVergilx’s solution?

I understand that the player must cast a sphere to check for colliders, but then do I need to add colliders to the bullets themselves? Or should they also be calling OverlapSphere?

Thank you very much :slight_smile:

Use raycasts on projectiles if they’re small enough, that way it would be faster.
Otherwise attaching collider to actual player is fine, just make sure to exclude player from queries when player should not be hit.

Note, if you don’t need 3d physics → use 2d physics.
Also, Collider2D is created / destroyed when enabled / disabled internally, which is way slower than it should be. So lots of colliders (thousands) might not be a good idea for mobile.

Otherwise both approaches valid.

This all makes so much more sense now. My player will have a collider2D while my projectiles will call a variant of OverlapCircle. Your posts in this thread have been very helpful to me. Thank you very much @VergilUa

1 Like