diff options
Diffstat (limited to 'modules/bullet/rigid_body_bullet.cpp')
-rw-r--r-- | modules/bullet/rigid_body_bullet.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index f2115a5d50..f96218ef46 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -690,7 +690,7 @@ void RigidBodyBullet::set_continuous_collision_detection(bool p_enable) { /// Calculate using the rule writte below the CCD swept sphere radius /// CCD works on an embedded sphere of radius, make sure this radius /// is embedded inside the convex objects, preferably smaller: - /// for an object of dimentions 1 meter, try 0.2 + /// for an object of dimensions 1 meter, try 0.2 btVector3 center; btScalar radius; btBody->getCollisionShape()->getBoundingSphere(center, radius); @@ -832,7 +832,8 @@ void RigidBodyBullet::on_exit_area(AreaBullet *p_area) { void RigidBodyBullet::reload_space_override_modificator() { - if (!is_active()) + // Make sure that kinematic bodies have their total gravity calculated + if (!is_active() && PhysicsServer::BODY_MODE_KINEMATIC != mode) return; Vector3 newGravity(space->get_gravity_direction() * space->get_gravity_magnitude()); @@ -955,7 +956,8 @@ void RigidBodyBullet::_internal_set_mass(real_t p_mass) { const bool isDynamic = p_mass != 0.f; if (isDynamic) { - ERR_FAIL_COND(PhysicsServer::BODY_MODE_RIGID != mode && PhysicsServer::BODY_MODE_CHARACTER != mode); + if (PhysicsServer::BODY_MODE_RIGID != mode && PhysicsServer::BODY_MODE_CHARACTER != mode) + return; m_isStatic = false; compoundShape->calculateLocalInertia(p_mass, localInertia); @@ -975,7 +977,8 @@ void RigidBodyBullet::_internal_set_mass(real_t p_mass) { } } else { - ERR_FAIL_COND(PhysicsServer::BODY_MODE_STATIC != mode && PhysicsServer::BODY_MODE_KINEMATIC != mode); + if (PhysicsServer::BODY_MODE_STATIC != mode && PhysicsServer::BODY_MODE_KINEMATIC != mode) + return; m_isStatic = true; if (PhysicsServer::BODY_MODE_STATIC == mode) { |