Showing the changes to libraries/physics/src/ObjectActionSpring.cpp (1 of 2 files). Show all
Unified · Split
| @@ -55,6 +55,17 @@ void ObjectActionSpring::updateActionWorker(btScalar deltaTimeStep) { · 54 unmodified lines | ||
| 55 | 55 | |
| 56 | 56 | // handle the linear part |
| 57 | 57 | if (_positionalTargetSet) { |
| 58 | + // check for NaN | |
| 59 | + if (_positionalTarget.x != _positionalTarget.x || | |
| 60 | + _positionalTarget.y != _positionalTarget.y || | |
| 61 | + _positionalTarget.z != _positionalTarget.z) { | |
| 62 | + qDebug() << "ObjectActionSpring::updateActionWorker -- target position includes NaN"; | |
| 63 | + unlock(); | |
| 64 | + lockForWrite(); | |
| 65 | + _active = false; | |
| 66 | + unlock(); | |
| 67 | + return; | |
| 68 | + } | |
| 58 | 69 | glm::vec3 offset = _positionalTarget - bulletToGLM(rigidBody->getCenterOfMassPosition()); |
| 59 | 70 | float offsetLength = glm::length(offset); |
| 60 | 71 | float speed = offsetLength / _linearTimeScale; |
| @@ -70,6 +81,18 @@ void ObjectActionSpring::updateActionWorker(btScalar deltaTimeStep) { · 9 unmodified lines | ||
| 70 | 81 | |
| 71 | 82 | // handle rotation |
| 72 | 83 | if (_rotationalTargetSet) { |
| 84 | + if (_rotationalTarget.x != _rotationalTarget.x || | |
| 85 | + _rotationalTarget.y != _rotationalTarget.y || | |
| 86 | + _rotationalTarget.z != _rotationalTarget.z || | |
| 87 | + _rotationalTarget.w != _rotationalTarget.w) { | |
| 88 | + qDebug() << "AvatarActionHold::updateActionWorker -- target rotation includes NaN"; | |
| 89 | + unlock(); | |
| 90 | + lockForWrite(); | |
| 91 | + _active = false; | |
| 92 | + unlock(); | |
| 93 | + return; | |
| 94 | + } | |
| 95 | + | |
| 73 | 96 | glm::quat bodyRotation = bulletToGLM(rigidBody->getOrientation()); |
| 74 | 97 | // if qZero and qOne are too close to each other, we can get NaN for angle. |
| 75 | 98 | auto alignmentDot = glm::dot(bodyRotation, _rotationalTarget); |