summaryrefslogtreecommitdiff
path: root/modules/bullet/bullet_physics_server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/bullet/bullet_physics_server.cpp')
-rw-r--r--modules/bullet/bullet_physics_server.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp
index c20fade011..55686543f3 100644
--- a/modules/bullet/bullet_physics_server.cpp
+++ b/modules/bullet/bullet_physics_server.cpp
@@ -326,8 +326,9 @@ void BulletPhysicsServer3D::area_clear_shapes(RID p_area) {
AreaBullet *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
- for (int i = area->get_shape_count(); 0 < i; --i)
+ for (int i = area->get_shape_count(); 0 < i; --i) {
area->remove_shape_full(0);
+ }
}
void BulletPhysicsServer3D::area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled) {
@@ -443,8 +444,9 @@ RID BulletPhysicsServer3D::body_create(BodyMode p_mode, bool p_init_sleeping) {
body->set_mode(p_mode);
body->set_collision_layer(1);
body->set_collision_mask(1);
- if (p_init_sleeping)
+ if (p_init_sleeping) {
body->set_state(BODY_STATE_SLEEPING, p_init_sleeping);
+ }
CreateThenReturnRID(rigid_body_owner, body);
}
@@ -458,8 +460,9 @@ void BulletPhysicsServer3D::body_set_space(RID p_body, RID p_space) {
ERR_FAIL_COND(!space);
}
- if (body->get_space() == space)
+ if (body->get_space() == space) {
return; //pointles
+ }
body->set_space(space);
}
@@ -469,8 +472,9 @@ RID BulletPhysicsServer3D::body_get_space(RID p_body) const {
ERR_FAIL_COND_V(!body, RID());
SpaceBullet *space = body->get_space();
- if (!space)
+ if (!space) {
return RID();
+ }
return space->get_self();
}
@@ -870,8 +874,9 @@ RID BulletPhysicsServer3D::soft_body_create(bool p_init_sleeping) {
SoftBodyBullet *body = bulletnew(SoftBodyBullet);
body->set_collision_layer(1);
body->set_collision_mask(1);
- if (p_init_sleeping)
+ if (p_init_sleeping) {
body->set_activation_state(false);
+ }
CreateThenReturnRID(soft_body_owner, body);
}
@@ -892,8 +897,9 @@ void BulletPhysicsServer3D::soft_body_set_space(RID p_body, RID p_space) {
ERR_FAIL_COND(!space);
}
- if (body->get_space() == space)
+ if (body->get_space() == space) {
return; //pointles
+ }
body->set_space(space);
}
@@ -903,8 +909,9 @@ RID BulletPhysicsServer3D::soft_body_get_space(RID p_body) const {
ERR_FAIL_COND_V(!body, RID());
SpaceBullet *space = body->get_space();
- if (!space)
+ if (!space) {
return RID();
+ }
return space->get_self();
}
@@ -1535,8 +1542,9 @@ void BulletPhysicsServer3D::init() {
}
void BulletPhysicsServer3D::step(float p_deltaTime) {
- if (!active)
+ if (!active) {
return;
+ }
BulletPhysicsDirectBodyState3D::singleton_setDeltaTime(p_deltaTime);