mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 16:26:17 +02:00
keep small masses from introducing NaN into bullet's calculations
This commit is contained in:
parent
0cadb95d62
commit
a2399ea1f6
1 changed files with 4 additions and 0 deletions
|
@ -105,6 +105,10 @@ void PhysicsEngine::addObjectToDynamicsWorld(ObjectMotionState* motionState) {
|
|||
}
|
||||
case MOTION_TYPE_DYNAMIC: {
|
||||
mass = motionState->getMass();
|
||||
if (mass != mass || mass < 1.0f) {
|
||||
qCDebug(physics) << "mass is too low, setting to 1.0 Kg --" << mass;
|
||||
mass = 1.0f;
|
||||
}
|
||||
btCollisionShape* shape = const_cast<btCollisionShape*>(motionState->getShape());
|
||||
assert(shape);
|
||||
shape->calculateLocalInertia(mass, inertia);
|
||||
|
|
Loading…
Reference in a new issue