From 521eb196255cefc848d194e2aabcd9a47d1d5a52 Mon Sep 17 00:00:00 2001 From: atlante45 Date: Thu, 8 Aug 2013 16:22:26 -0700 Subject: [PATCH] PR comments + Changed MIN and MAX scale --- interface/src/avatar/Avatar.cpp | 16 ++++++++++------ interface/src/avatar/Avatar.h | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index ddc7b9926d..e561720eaf 100755 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -433,7 +433,11 @@ void Avatar::updateThrust(float deltaTime, Transmitter * transmitter) { // Add thrusts from leading avatar - const float FOLLOWING_RATE = .02f; + const float FOLLOWING_RATE = 0.02f; + const float MIN_YAW = 5.0f; + const float MIN_PITCH = 1.0f; + const float PITCH_RATE = 0.1f; + const float MIN_YAW_BEFORE_PITCH = 30.0f; if (_leadingAvatar != NULL) { glm::vec3 toTarget = _leadingAvatar->getPosition() - _position; @@ -448,7 +452,7 @@ void Avatar::updateThrust(float deltaTime, Transmitter * transmitter) { glm::dot(front, toTarget)); float yawAngle = angleBetween(-IDENTITY_FRONT, glm::vec3(toTarget.x, 0.f, toTarget.z)); - if (5.f < glm::abs(yawAngle)){ + if (glm::abs(yawAngle) > MIN_YAW){ if (IDENTITY_RIGHT.x * toTarget.x + IDENTITY_RIGHT.y * toTarget.y + IDENTITY_RIGHT.z * toTarget.z > 0) { _bodyYawDelta -= yawAngle; } else { @@ -456,12 +460,12 @@ void Avatar::updateThrust(float deltaTime, Transmitter * transmitter) { } } - float pitchAngle = glm::abs(90.f - angleBetween(IDENTITY_UP, toTarget)); - if (1.f < glm::abs(pitchAngle) && yawAngle < 30.f){ + float pitchAngle = glm::abs(90.0f - angleBetween(IDENTITY_UP, toTarget)); + if (glm::abs(pitchAngle) > MIN_PITCH && yawAngle < MIN_YAW_BEFORE_PITCH){ if (IDENTITY_UP.x * toTarget.x + IDENTITY_UP.y * toTarget.y + IDENTITY_UP.z * toTarget.z > 0) { - _head.setMousePitch(_head.getMousePitch() + .10f * pitchAngle); + _head.setMousePitch(_head.getMousePitch() + PITCH_RATE * pitchAngle); } else { - _head.setMousePitch(_head.getMousePitch() - .10f * pitchAngle); + _head.setMousePitch(_head.getMousePitch() - PITCH_RATE * pitchAngle); } _head.setPitch(_head.getMousePitch()); } diff --git a/interface/src/avatar/Avatar.h b/interface/src/avatar/Avatar.h index 155028c43f..29a79047ed 100755 --- a/interface/src/avatar/Avatar.h +++ b/interface/src/avatar/Avatar.h @@ -27,8 +27,8 @@ #include "world.h" -static const float MAX_SCALE = 10.f; -static const float MIN_SCALE = .5f; +static const float MAX_SCALE = 1000.f; +static const float MIN_SCALE = .005f; static const float SCALING_RATIO = .05f; static const float SMOOTHING_RATIO = .05f; // 0 < ratio < 1 static const float RESCALING_TOLERANCE = .02f;