summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-03-22 15:11:19 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-03-22 15:11:36 -0300
commite9f94ce8d2cc6805e74fffdf733e6dc5b5c530f5 (patch)
tree05c38090012eae3a0e54b3ed45596b9a6443b744 /servers
parent15bee515e63f8d9d93fc9aacd00f2b99e37cd58b (diff)
fix area center of gravity
Diffstat (limited to 'servers')
-rw-r--r--servers/physics/body_sw.cpp2
-rw-r--r--servers/physics_2d/body_2d_sw.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp
index 725a440b59..c7c20a8bd1 100644
--- a/servers/physics/body_sw.cpp
+++ b/servers/physics/body_sw.cpp
@@ -358,7 +358,7 @@ void BodySW::_compute_area_gravity(const AreaSW *p_area) {
if (p_area->is_gravity_point()) {
- gravity = (p_area->get_gravity_vector() - get_transform().get_origin()).normalized() * p_area->get_gravity();
+ gravity = (p_area->get_transform().xform(p_area->get_gravity_vector()) - get_transform().get_origin()).normalized() * p_area->get_gravity();
} else {
gravity = p_area->get_gravity_vector() * p_area->get_gravity();
diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp
index 1cfe9a6ab9..06d466ace8 100644
--- a/servers/physics_2d/body_2d_sw.cpp
+++ b/servers/physics_2d/body_2d_sw.cpp
@@ -379,7 +379,7 @@ void Body2DSW::_compute_area_gravity(const Area2DSW *p_area) {
if (p_area->is_gravity_point()) {
- gravity = (p_area->get_transform().get_origin()+p_area->get_gravity_vector() - get_transform().get_origin()).normalized() * p_area->get_gravity();
+ gravity = (p_area->get_transform().xform(p_area->get_gravity_vector()) - get_transform().get_origin()).normalized() * p_area->get_gravity();
} else {
gravity = p_area->get_gravity_vector() * p_area->get_gravity();