diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2017-07-25 04:18:03 +0200 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2017-07-25 04:45:01 +0200 |
commit | bc1d58c50d65818863b620a4871e327c5f1c6bb6 (patch) | |
tree | 9a81923399fd55c836c835c1ea831acd98401b3b /servers/physics_2d | |
parent | 507b48179f773d6495ce62947c7f55564fde4a67 (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.cpp | 7 |
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); }; |