PR comments + Changed MIN and MAX scale

This commit is contained in:
atlante45 2013-08-08 16:22:26 -07:00
parent 1117bb4305
commit 521eb19625
2 changed files with 12 additions and 8 deletions

View file

@ -433,7 +433,11 @@ void Avatar::updateThrust(float deltaTime, Transmitter * transmitter) {
// Add thrusts from leading avatar // 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) { if (_leadingAvatar != NULL) {
glm::vec3 toTarget = _leadingAvatar->getPosition() - _position; glm::vec3 toTarget = _leadingAvatar->getPosition() - _position;
@ -448,7 +452,7 @@ void Avatar::updateThrust(float deltaTime, Transmitter * transmitter) {
glm::dot(front, toTarget)); glm::dot(front, toTarget));
float yawAngle = angleBetween(-IDENTITY_FRONT, glm::vec3(toTarget.x, 0.f, toTarget.z)); 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) { if (IDENTITY_RIGHT.x * toTarget.x + IDENTITY_RIGHT.y * toTarget.y + IDENTITY_RIGHT.z * toTarget.z > 0) {
_bodyYawDelta -= yawAngle; _bodyYawDelta -= yawAngle;
} else { } else {
@ -456,12 +460,12 @@ void Avatar::updateThrust(float deltaTime, Transmitter * transmitter) {
} }
} }
float pitchAngle = glm::abs(90.f - angleBetween(IDENTITY_UP, toTarget)); float pitchAngle = glm::abs(90.0f - angleBetween(IDENTITY_UP, toTarget));
if (1.f < glm::abs(pitchAngle) && yawAngle < 30.f){ 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) { 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 { } else {
_head.setMousePitch(_head.getMousePitch() - .10f * pitchAngle); _head.setMousePitch(_head.getMousePitch() - PITCH_RATE * pitchAngle);
} }
_head.setPitch(_head.getMousePitch()); _head.setPitch(_head.getMousePitch());
} }

View file

@ -27,8 +27,8 @@
#include "world.h" #include "world.h"
static const float MAX_SCALE = 10.f; static const float MAX_SCALE = 1000.f;
static const float MIN_SCALE = .5f; static const float MIN_SCALE = .005f;
static const float SCALING_RATIO = .05f; static const float SCALING_RATIO = .05f;
static const float SMOOTHING_RATIO = .05f; // 0 < ratio < 1 static const float SMOOTHING_RATIO = .05f; // 0 < ratio < 1
static const float RESCALING_TOLERANCE = .02f; static const float RESCALING_TOLERANCE = .02f;