code review feedback

This commit is contained in:
Anthony J. Thibault 2017-12-07 10:49:23 -08:00
parent 68ad27a38d
commit 47b52238d9
2 changed files with 5 additions and 5 deletions

View file

@ -1969,7 +1969,7 @@ void MyAvatar::updateOrientation(float deltaTime) {
if (qApp->isHMDMode() && getCharacterController()->getState() == CharacterController::State::Hover && _hmdRollControlEnabled && hasDriveInput()) { if (qApp->isHMDMode() && getCharacterController()->getState() == CharacterController::State::Hover && _hmdRollControlEnabled && hasDriveInput()) {
// Turn with head roll. // Turn with head roll.
const float MIN_CONTROL_SPEED = 2.0f; // meters / sec const float MIN_CONTROL_SPEED = 2.0f * getSensorToWorldScale(); // meters / sec
const glm::vec3 characterForward = getWorldOrientation() * Vectors::UNIT_NEG_Z; const glm::vec3 characterForward = getWorldOrientation() * Vectors::UNIT_NEG_Z;
float forwardSpeed = glm::dot(characterForward, getWorldVelocity()); float forwardSpeed = glm::dot(characterForward, getWorldVelocity());
@ -1985,13 +1985,13 @@ void MyAvatar::updateOrientation(float deltaTime) {
const float MAX_ROLL_ANGLE = 90.0f; // degrees const float MAX_ROLL_ANGLE = 90.0f; // degrees
if (rollAngle > MIN_ROLL_ANGLE) { if (rollAngle > MIN_ROLL_ANGLE) {
// rate of turning is linearly proportional to rolAngle // rate of turning is linearly proportional to rollAngle
rollAngle = glm::clamp(rollAngle, MIN_ROLL_ANGLE, MAX_ROLL_ANGLE); rollAngle = glm::clamp(rollAngle, MIN_ROLL_ANGLE, MAX_ROLL_ANGLE);
// scale rollAngle into a value from zero to one. // scale rollAngle into a value from zero to one.
float t = (rollAngle - MIN_ROLL_ANGLE) / (MAX_ROLL_ANGLE - MIN_ROLL_ANGLE); float rollFactor = (rollAngle - MIN_ROLL_ANGLE) / (MAX_ROLL_ANGLE - MIN_ROLL_ANGLE);
float angularSpeed = rollSign * t * _hmdRollControlRate; float angularSpeed = rollSign * rollFactor * _hmdRollControlRate;
totalBodyYaw += direction * angularSpeed * deltaTime; totalBodyYaw += direction * angularSpeed * deltaTime;
} }
} }

View file

@ -741,7 +741,7 @@ private:
bool _clearOverlayWhenMoving { true }; bool _clearOverlayWhenMoving { true };
QString _dominantHand { DOMINANT_RIGHT_HAND }; QString _dominantHand { DOMINANT_RIGHT_HAND };
const float ROLL_CONTROL_DEAD_ZONE_DEFAULT = 8.0; // degrees const float ROLL_CONTROL_DEAD_ZONE_DEFAULT = 8.0f; // degrees
const float ROLL_CONTROL_RATE_DEFAULT = 114.0f; // degrees / sec const float ROLL_CONTROL_RATE_DEFAULT = 114.0f; // degrees / sec
bool _hmdRollControlEnabled { true }; bool _hmdRollControlEnabled { true };