diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index d609ca0efc..e4189b8bf2 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -5562,8 +5562,8 @@ MyAvatar::FollowHelper::FollowHelper() { } void MyAvatar::FollowHelper::deactivate() { - for (uint i = 0, e = static_cast(CharacterController::FollowType::Count); i < e; ++i) { - deactivate((CharacterController::FollowType)i); + for (uint i = 0; i < static_cast(CharacterController::FollowType::Count); i++) { + deactivate(static_cast(i)); } } @@ -5588,8 +5588,8 @@ bool MyAvatar::FollowHelper::isActive(CharacterController::FollowType type) cons } bool MyAvatar::FollowHelper::isActive() const { - for (uint i = 0, e = static_cast(CharacterController::FollowType::Count); i < e; ++i) { - if (isActive((CharacterController::FollowType)i)) { + for (uint i = 0; i < static_cast(CharacterController::FollowType::Count); i++) { + if (isActive(static_cast(i))) { return true; } } @@ -5597,12 +5597,12 @@ bool MyAvatar::FollowHelper::isActive() const { } void MyAvatar::FollowHelper::decrementTimeRemaining(float dt) { - for (uint i = 0, e = static_cast(CharacterController::FollowType::Count); i < e; ++i) { - if (_timeRemaining[i] == CharacterController::FOLLOW_TIME_IMMEDIATE_SNAP) { - _timeRemaining[i] = 0.f; + for (auto& time : _timeRemaining) { + if (time == CharacterController::FOLLOW_TIME_IMMEDIATE_SNAP) { + time = 0.0f; } else { - _timeRemaining[i] -= dt; + time -= dt; } } } @@ -5612,13 +5612,14 @@ bool MyAvatar::FollowHelper::shouldActivateRotation(const MyAvatar& myAvatar, const glm::mat4& desiredBodyMatrix, const glm::mat4& currentBodyMatrix, bool& shouldSnapOut) const { - shouldSnapOut = false; - // If hips are under direct control (tracked), they give our desired body rotation and we snap to it every frame. if (myAvatar.areHipsTracked()) { shouldSnapOut = true; return true; } + else { + shouldSnapOut = false; + } const float FOLLOW_ROTATION_THRESHOLD = cosf(myAvatar.getRotationThreshold()); glm::vec2 bodyFacing = getFacingDir2D(currentBodyMatrix); @@ -5875,7 +5876,6 @@ glm::mat4 MyAvatar::FollowHelper::postPhysicsUpdate(MyAvatar& myAvatar, const gl setTranslation(newBodyMat, extractTranslation(myAvatar.deriveBodyFromHMDSensor())); } } - return newBodyMat; } else { return currentBodyMatrix; diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index bcdef45440..8b49334925 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -2716,7 +2716,7 @@ void Rig::computeAvatarBoundingCapsule( // HACK by convention our Avatars are always modeled such that y=0 (GEOMETRY_GROUND_Y) is the ground plane. // add the ground point so that our avatars will always have bounding volumes that are flush with the ground // even if they do not have legs (default robot) - totalExtents.addPoint(glm::vec3(0.f, GEOMETRY_GROUND_Y, 0.f)); + totalExtents.addPoint(glm::vec3(0.0f, GEOMETRY_GROUND_Y, 0.0f)); // To reduce the radius of the bounding capsule to be tight with the torso, we only consider joints // from the head to the hips when computing the rest of the bounding capsule. diff --git a/libraries/physics/src/CharacterController.cpp b/libraries/physics/src/CharacterController.cpp index aa4d8c42e3..04ccd9e547 100755 --- a/libraries/physics/src/CharacterController.cpp +++ b/libraries/physics/src/CharacterController.cpp @@ -368,10 +368,8 @@ void CharacterController::playerStep(btCollisionWorld* collisionWorld, btScalar btVector3 startPos = bodyTransform.getOrigin(); btVector3 deltaPos = _followDesiredBodyTransform.getOrigin() - startPos; - btVector3 linearDisplacement(0, 0, 0); + btVector3 linearDisplacement(0.0f, 0.0f, 0.0f); { - linearDisplacement.setZero(); - const float horizontalTime = _followTimeRemainingPerType[static_cast(FollowType::Horizontal)]; const float verticalTime = _followTimeRemainingPerType[static_cast(FollowType::Vertical)]; @@ -452,7 +450,6 @@ void CharacterController::playerStep(btCollisionWorld* collisionWorld, btScalar } _rigidBody->setWorldTransform(btTransform(endRot, endPos)); } - _followTime += dt; if (_steppingUp) {