mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-06 13:41:11 +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: {
|
case MOTION_TYPE_DYNAMIC: {
|
||||||
mass = motionState->getMass();
|
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());
|
btCollisionShape* shape = const_cast<btCollisionShape*>(motionState->getShape());
|
||||||
assert(shape);
|
assert(shape);
|
||||||
shape->calculateLocalInertia(mass, inertia);
|
shape->calculateLocalInertia(mass, inertia);
|
||||||
|
|
Loading…
Reference in a new issue