How to make explosion fragments ricochet or bounce off walls

Creating explosions with, for example, the CPUParticles2D node is not difficult.

However, it is unclear how to make the explosion fragments bounce off walls or other objects.

Is there a video, tutorial, or some clue explaining how to do this?

I can somehow imagine creating a node for each fragment but it is unclear to me how to proceed.

Thank you all.

I couldn’t find anything. GPUparticles2d seem to have collision support though.

1 Like

Thank you. I will look into it.

If you plan on using CPUParticles2D for physics-based effects and make it look good, I would recommend on creating a scene that can be cached early in the top scene and instantiated (as a copy) wherever you want the explosion to happen.

That instantiated scene node could have various CPUParticles2D nodes for the various effects you want to generate: the explosion blast being one, the fragment being another (which you can, also, change the color based on what’s exploding) and only that 2nd particle node would have physics applied to it. (This also allows you to create various emission forms for the various parts of the explosion.) You can code the effects stages or use an animation node to handle everything.

If you use GPUParticles2D instead, you can use particles sub-emitters to generate the various stages/effects and physics-dependent bits.

1 Like

The detailed information is appreciated. I am still struggling with a sprite being blown off and its fragments bouncing off the walls.