Godot Version
4.3 stable Windows 11
Question
I’m making a bullet hell game. I’m trying out object pooling on bullets to improve performance, but I have a problem: I can’t seem to figure out how to do that with bullets of different hitbox shapes. For example, i have a ball_medium bullet with a circle hitbox, and a knife bullet with a rectangular hitbox.
I tried something like this, and whenever I call a bullet from the pool I define its type, and I make every sprite2D node but the correct one invisible when it activates, but making nodes invisible doesn’t stop them from processing, detecting collision, and hindering performance.
I don’t think I could just make different bullet scenes for each bullet type, because then I’d have to make multiple pools and that’s not ideal.
I don’t suppose having just one bullet scene, then queue_freeing and instancing the sprite and hitbox for every activation would work either, because that would make all my object pooling efforts pointless.
What I’d like is: an object pool of instances of one single bullet scene, which when activated and used will have a different sprite and hitbox depending on the bullet type I assign to it. Is this possible? What’s an efficient way to do it? Any help is appreciated.
P.S. I don’t dare mess with physic servers yet because I don’t know how to work with them.