mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-05 21:22:52 +02:00
fix hinge-constraint constructors to use otherAxis
This commit is contained in:
parent
db98020974
commit
d42970d480
1 changed files with 6 additions and 13 deletions
|
@ -84,31 +84,24 @@ btTypedConstraint* ObjectConstraintHinge::getConstraint() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool useReferenceFrameA { false };
|
|
||||||
|
|
||||||
if (!otherEntityID.isNull()) {
|
if (!otherEntityID.isNull()) {
|
||||||
// This hinge is between two entities... find the other rigid body.
|
// This hinge is between two entities... find the other rigid body.
|
||||||
btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID);
|
btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID);
|
||||||
if (!rigidBodyB) {
|
if (!rigidBodyB) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
btTransform rigidBodyAFrame(btQuaternion(0.0f, 0.0f, 0.0f, 1.0f), glmToBullet(pivotInA));
|
|
||||||
btTransform rigidBodyBFrame(btQuaternion(0.0f, 0.0f, 0.0f, 1.0f), glmToBullet(pivotInB));
|
|
||||||
|
|
||||||
constraint = new btHingeConstraint(*rigidBodyA, *rigidBodyB,
|
constraint = new btHingeConstraint(*rigidBodyA, *rigidBodyB,
|
||||||
rigidBodyAFrame, rigidBodyBFrame,
|
glmToBullet(pivotInA), glmToBullet(pivotInB),
|
||||||
useReferenceFrameA);
|
glmToBullet(axisInA), glmToBullet(axisInB),
|
||||||
|
true); // useReferenceFrameA
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// This hinge is between an entity and the world-frame.
|
// This hinge is between an entity and the world-frame.
|
||||||
btTransform rigidBodyAFrame(btQuaternion(0.0f, 0.0f, 0.0f, 1.0f), glmToBullet(pivotInA));
|
constraint = new btHingeConstraint(*rigidBodyA,
|
||||||
|
glmToBullet(pivotInA), glmToBullet(axisInA),
|
||||||
constraint = new btHingeConstraint(*rigidBodyA, rigidBodyAFrame, useReferenceFrameA);
|
true); // useReferenceFrameA
|
||||||
}
|
}
|
||||||
|
|
||||||
btVector3 bulletAxisInA = glmToBullet(axisInA);
|
|
||||||
constraint->setAxis(bulletAxisInA);
|
|
||||||
constraint->setLimit(low, high, softness, biasFactor, relaxationFactor);
|
constraint->setLimit(low, high, softness, biasFactor, relaxationFactor);
|
||||||
|
|
||||||
withWriteLock([&]{
|
withWriteLock([&]{
|
||||||
|
|
Loading…
Reference in a new issue