Apply_impulse isn't working correctly

Godot Version

4.1.3

Question

Hey there Godot experts!

Trying to make a Normal Rigidbody2D be affected by an apply_impulse but for some reason it’s not working.
The script itself is in an Area2D. I’m wondering if it is because the RigidBody isn’t being called through _integrate_forces? If so, how do I call it to the body itself?

I haven’t used 2D in Godot yet, but I believe it’s similar to 3D in most aspects.

Looking at your apply_impulse call, it seems you have reversed the parameters.
From Godot Docs:
void apply_impulse ( Vector2 impulse, Vector2 position=Vector2(0, 0)

Here’s a list of things you should also consider:

  • monitoring on your Area2D should be set to true
  • Make sure your rigidbody2D has a collisionShape2D
  • Normally, when I work with collisions, I use the body_entered and body_exited signals. Consider using these over get_overlapping_bodies()

The damage code itself looks good though.