From ffaced87a652109bf150f2680b666a8602d04103 Mon Sep 17 00:00:00 2001 From: Josh Grams Date: Sun, 24 Apr 2016 04:35:21 -0400 Subject: [PATCH] RigidBody2D: rename apply_impulse(pos) to offset. --- scene/2d/physics_body_2d.cpp | 4 ++-- scene/2d/physics_body_2d.h | 2 +- servers/physics_2d/body_2d_sw.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 933e1579b25..517967bf6ce 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -772,9 +772,9 @@ int RigidBody2D::get_max_contacts_reported() const{ return max_contacts_reported; } -void RigidBody2D::apply_impulse(const Vector2& p_pos, const Vector2& p_impulse) { +void RigidBody2D::apply_impulse(const Vector2& p_offset, const Vector2& p_impulse) { - Physics2DServer::get_singleton()->body_apply_impulse(get_rid(),p_pos,p_impulse); + Physics2DServer::get_singleton()->body_apply_impulse(get_rid(),p_offset,p_impulse); } void RigidBody2D::set_applied_force(const Vector2& p_force) { diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index 7523413df35..31dbfbcc6f6 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -263,7 +263,7 @@ public: void set_continuous_collision_detection_mode(CCDMode p_mode); CCDMode get_continuous_collision_detection_mode() const; - void apply_impulse(const Vector2& p_pos, const Vector2& p_impulse); + void apply_impulse(const Vector2& p_offset, const Vector2& p_impulse); void set_applied_force(const Vector2& p_force); Vector2 get_applied_force() const; diff --git a/servers/physics_2d/body_2d_sw.h b/servers/physics_2d/body_2d_sw.h index b7f3ab01db4..6d9bf3cb03c 100644 --- a/servers/physics_2d/body_2d_sw.h +++ b/servers/physics_2d/body_2d_sw.h @@ -204,10 +204,10 @@ public: _FORCE_INLINE_ real_t get_biased_angular_velocity() const { return biased_angular_velocity; } - _FORCE_INLINE_ void apply_impulse(const Vector2& p_pos, const Vector2& p_j) { + _FORCE_INLINE_ void apply_impulse(const Vector2& p_offset, const Vector2& p_impulse) { - linear_velocity += p_j * _inv_mass; - angular_velocity += _inv_inertia * p_pos.cross(p_j); + linear_velocity += p_impulse * _inv_mass; + angular_velocity += _inv_inertia * p_offset.cross(p_impulse); } _FORCE_INLINE_ void apply_bias_impulse(const Vector2& p_pos, const Vector2& p_j) {