mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-15 11:38:16 +02:00
react to very small vectors instead of just zero-length ones
This commit is contained in:
parent
f867a8e718
commit
c693687927
1 changed files with 6 additions and 6 deletions
|
@ -104,13 +104,13 @@ btTypedConstraint* ObjectConstraintHinge::getConstraint() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (glm::length(axisInA) == 0.0f) {
|
||||
if (glm::length(axisInA) < FLT_EPSILON) {
|
||||
qCWarning(physics) << "hinge axis cannot be a zero vector";
|
||||
axisInA = DEFAULT_HINGE_AXIS;
|
||||
} else {
|
||||
axisInA = glm::normalize(axisInA);
|
||||
}
|
||||
|
||||
axisInA = glm::normalize(axisInA);
|
||||
|
||||
if (!otherEntityID.isNull()) {
|
||||
// This hinge is between two entities... find the other rigid body.
|
||||
btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID);
|
||||
|
@ -118,13 +118,13 @@ btTypedConstraint* ObjectConstraintHinge::getConstraint() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (glm::length(axisInB)) {
|
||||
if (glm::length(axisInB) < FLT_EPSILON) {
|
||||
qCWarning(physics) << "hinge axis cannot be a zero vector";
|
||||
axisInB = DEFAULT_HINGE_AXIS;
|
||||
} else {
|
||||
axisInB = glm::normalize(axisInB);
|
||||
}
|
||||
|
||||
axisInB = glm::normalize(axisInB);
|
||||
|
||||
constraint = new btHingeConstraint(*rigidBodyA, *rigidBodyB,
|
||||
glmToBullet(pivotInA), glmToBullet(pivotInB),
|
||||
glmToBullet(axisInA), glmToBullet(axisInB),
|
||||
|
|
Loading…
Reference in a new issue