Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | BeepBoop |
I have a multiple RigidBody2D “targets” stacked in a pyramid (like Angry Birds) and I’m trying to make an explosion effect so that when the user clicks, the targets within a certain distance of the click position are “blown away” from the click point.
So far my approach is to instance an Explosion scene at the click location which has a CollisionBody2D child and using the on body entered signal I can get a list of the overlapping targets. However I’m now struggling to figure out what value to call add_central_impulse with to make the overlapping targets “blow away” in the right direction. I think I need to do something with the angle between the centre of the explosion (the mouse click point) and the centre point of the target but I don’t know how to calculate that and if it’s actually the right value to call add_central_impulse with