From d42970d4803a5428f214fd3b1bb43c124224044c Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sat, 15 Apr 2017 08:51:08 -0700 Subject: [PATCH] fix hinge-constraint constructors to use otherAxis --- .../physics/src/ObjectConstraintHinge.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/libraries/physics/src/ObjectConstraintHinge.cpp b/libraries/physics/src/ObjectConstraintHinge.cpp index 82a793ddaa..f52bb80151 100644 --- a/libraries/physics/src/ObjectConstraintHinge.cpp +++ b/libraries/physics/src/ObjectConstraintHinge.cpp @@ -84,31 +84,24 @@ btTypedConstraint* ObjectConstraintHinge::getConstraint() { return nullptr; } - bool useReferenceFrameA { false }; - if (!otherEntityID.isNull()) { // This hinge is between two entities... find the other rigid body. btRigidBody* rigidBodyB = getOtherRigidBody(otherEntityID); if (!rigidBodyB) { 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, - rigidBodyAFrame, rigidBodyBFrame, - useReferenceFrameA); + glmToBullet(pivotInA), glmToBullet(pivotInB), + glmToBullet(axisInA), glmToBullet(axisInB), + true); // useReferenceFrameA } else { // 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, rigidBodyAFrame, useReferenceFrameA); + constraint = new btHingeConstraint(*rigidBodyA, + glmToBullet(pivotInA), glmToBullet(axisInA), + true); // useReferenceFrameA } - btVector3 bulletAxisInA = glmToBullet(axisInA); - constraint->setAxis(bulletAxisInA); constraint->setLimit(low, high, softness, biasFactor, relaxationFactor); withWriteLock([&]{