Extend check for same space to all 2D/3D bodies/shapes
This commit is contained in:
parent
507b48179f
commit
bc1d58c50d
2 changed files with 13 additions and 2 deletions
|
@ -222,12 +222,16 @@ void PhysicsServerSW::area_set_space(RID p_area, RID p_space) {
|
|||
|
||||
AreaSW *area = area_owner.get(p_area);
|
||||
ERR_FAIL_COND(!area);
|
||||
|
||||
SpaceSW *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);
|
||||
};
|
||||
|
||||
|
@ -471,15 +475,15 @@ void PhysicsServerSW::body_set_space(RID p_body, RID p_space) {
|
|||
|
||||
BodySW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
SpaceSW *space = NULL;
|
||||
|
||||
SpaceSW *space = NULL;
|
||||
if (p_space.is_valid()) {
|
||||
space = space_owner.get(p_space);
|
||||
ERR_FAIL_COND(!space);
|
||||
}
|
||||
|
||||
if (body->get_space() == space)
|
||||
return; //pointles
|
||||
return; //pointless
|
||||
|
||||
body->set_space(space);
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue