From 25070c3bcaf973aaafba029eec7e7c5020ddfeff Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sat, 22 Apr 2017 17:56:40 -0700 Subject: [PATCH] try not bringing motor target into -PI,PI range --- .../physics/src/ObjectConstraintHinge.cpp | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/libraries/physics/src/ObjectConstraintHinge.cpp b/libraries/physics/src/ObjectConstraintHinge.cpp index 036adbc915..e14c467228 100644 --- a/libraries/physics/src/ObjectConstraintHinge.cpp +++ b/libraries/physics/src/ObjectConstraintHinge.cpp @@ -77,10 +77,10 @@ void ObjectConstraintHinge::prepareForPhysicsSimulation() { float t = (float)(now - _startMotorTime) / (float)USECS_PER_SECOND; float motorTarget = _motorVelocity * t; - // brige motorTarget into the range of [-PI, PI] - motorTarget += PI; - motorTarget = fmodf(motorTarget, 2.0f * PI); - motorTarget -= PI; + // // bring motorTarget into the range of [-PI, PI] + // motorTarget += PI; + // motorTarget = fmodf(motorTarget, 2.0f * PI); + // motorTarget -= PI; if (!_motorEnabled) { constraint->enableMotor(true); @@ -88,6 +88,7 @@ void ObjectConstraintHinge::prepareForPhysicsSimulation() { } constraint->setMaxMotorImpulse(_maxImpulse); constraint->setMotorTarget(motorTarget, dt); + } else if (_motorTargetTimeScale > 0.0f) { // XXX } else if (_motorEnabled) { @@ -131,21 +132,6 @@ void ObjectConstraintHinge::updateHinge() { if (!constraint) { return; } - - // constraint->setLimit(low, high, softness, biasFactor, relaxationFactor); - // if (motorTargetTimeScale > 0.0f) { - // qDebug() << "--- setting motor target:" << motorTarget << motorTargetTimeScale; - // constraint->setMotorTarget(motorTarget, motorTargetTimeScale); - // constraint->enableMotor(true); - // withWriteLock([&]{ - // _motorTargetTimeScale = 0.0f; // it's a one-shot. - // }); - // } else if (motorVelocity != 0.0f) { - // // constraint->setMotorTargetVelocity(motorVelocity); - // // constraint->enableMotor(true); - // } else { - // constraint->enableMotor(false); - // } }