summaryrefslogtreecommitdiff
path: root/servers/physics_2d
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2017-07-25 04:18:03 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2017-07-25 04:45:01 +0200
commitbc1d58c50d65818863b620a4871e327c5f1c6bb6 (patch)
tree9a81923399fd55c836c835c1ea831acd98401b3b /servers/physics_2d
parent507b48179f773d6495ce62947c7f55564fde4a67 (diff)
Extend check for same space to all 2D/3D bodies/shapes
Diffstat (limited to 'servers/physics_2d')
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index c20d0d14a2..98fe7da3ed 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -286,12 +286,16 @@ void Physics2DServerSW::area_set_space(RID p_area, RID p_space) {
Area2DSW *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
+
Space2DSW *space = NULL;
if (p_space.is_valid()) {
space = space_owner.get(p_space);
ERR_FAIL_COND(!space);
}
+ if (area->get_space() == space)
+ return; //pointless
+
area->set_space(space);
};
@@ -533,6 +537,9 @@ void Physics2DServerSW::body_set_space(RID p_body, RID p_space) {
ERR_FAIL_COND(!space);
}
+ if (body->get_space() == space)
+ return; //pointless
+
body->set_space(space);
};