summaryrefslogtreecommitdiff
path: root/servers/physics_2d/body_2d_sw.h
diff options
context:
space:
mode:
authorJosh Grams <josh@qualdan.com>2016-04-26 08:15:15 -0400
committerJosh Grams <josh@qualdan.com>2016-04-26 08:15:15 -0400
commita7b4127481d1f377a50ac5f62ec3f20e2ba71dff (patch)
tree011eb32b9e34b29d1a7c9011c33f501a51658302 /servers/physics_2d/body_2d_sw.h
parentffaced87a652109bf150f2680b666a8602d04103 (diff)
RigidBody2D (add_force, set_inertia): new methods.
Diffstat (limited to 'servers/physics_2d/body_2d_sw.h')
-rw-r--r--servers/physics_2d/body_2d_sw.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/servers/physics_2d/body_2d_sw.h b/servers/physics_2d/body_2d_sw.h
index 6d9bf3cb03..ed98017629 100644
--- a/servers/physics_2d/body_2d_sw.h
+++ b/servers/physics_2d/body_2d_sw.h
@@ -57,6 +57,7 @@ class Body2DSW : public CollisionObject2DSW {
real_t _inv_mass;
real_t _inv_inertia;
+ bool user_inertia;
Vector2 gravity;
real_t area_linear_damp;
@@ -243,6 +244,11 @@ public:
void set_applied_torque(real_t p_torque) { applied_torque=p_torque; }
real_t get_applied_torque() const { return applied_torque; }
+ _FORCE_INLINE_ void add_force(const Vector2& p_force, const Vector2& p_offset) {
+
+ applied_force += p_force;
+ applied_torque += p_offset.cross(p_force);
+ }
_FORCE_INLINE_ void set_continuous_collision_detection_mode(Physics2DServer::CCDMode p_mode) { continuous_cd_mode=p_mode; }
_FORCE_INLINE_ Physics2DServer::CCDMode get_continuous_collision_detection_mode() const { return continuous_cd_mode; }