diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2023-01-11 01:09:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-11 01:09:41 +0100 |
commit | c2f96a8b837de99c76db55a30f950c337b7637eb (patch) | |
tree | c2e75ab3412c4868c5e09862caed052751008227 /servers/physics_2d/godot_body_direct_state_2d.cpp | |
parent | 08ba509f8c71aa12159e9b20c1ed3b688c4412c3 (diff) | |
parent | 3efa10554824d2e3af797061b04e0653cd463292 (diff) |
Merge pull request #71191 from rburing/get_contact_impulse_2d
Add `get_contact_impulse` method to `PhysicsDirectBodyState2D`
Diffstat (limited to 'servers/physics_2d/godot_body_direct_state_2d.cpp')
-rw-r--r-- | servers/physics_2d/godot_body_direct_state_2d.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/servers/physics_2d/godot_body_direct_state_2d.cpp b/servers/physics_2d/godot_body_direct_state_2d.cpp index 35092b631a..2fa933ce17 100644 --- a/servers/physics_2d/godot_body_direct_state_2d.cpp +++ b/servers/physics_2d/godot_body_direct_state_2d.cpp @@ -210,6 +210,11 @@ Vector2 GodotPhysicsDirectBodyState2D::get_contact_collider_velocity_at_position return body->contacts[p_contact_idx].collider_velocity_at_pos; } +Vector2 GodotPhysicsDirectBodyState2D::get_contact_impulse(int p_contact_idx) const { + ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, Vector2()); + return body->contacts[p_contact_idx].impulse; +} + PhysicsDirectSpaceState2D *GodotPhysicsDirectBodyState2D::get_space_state() { return body->get_space()->get_direct_state(); } |