Revert to simply adding the Eulers.

This commit is contained in:
Andrzej Kapolka 2013-05-30 15:48:00 -07:00
parent 47bf5a2b77
commit 9213cfd0c2
3 changed files with 3 additions and 28 deletions

View file

@ -134,10 +134,9 @@ void Avatar::updateHeadFromGyros(float deltaTime, SerialInterface* serialInterfa
float measuredRollRate = serialInterface->getLastRollRate();
// Update avatar head position based on measured gyro rates
_head.addOrientation(
measuredPitchRate * AMPLIFY_PITCH * deltaTime,
measuredYawRate * AMPLIFY_YAW * deltaTime,
measuredRollRate * AMPLIFY_ROLL * deltaTime);
_head.addPitch(measuredPitchRate * AMPLIFY_PITCH * deltaTime);
_head.addYaw(measuredYawRate * AMPLIFY_YAW * deltaTime);
_head.addRoll(measuredRollRate * AMPLIFY_ROLL * deltaTime);
// Update head lean distance based on accelerometer data
glm::vec3 headRotationRates(_head.getPitch(), _head.getYaw(), _head.getRoll());

View file

@ -307,27 +307,6 @@ void Head::renderMohawk(glm::vec3 cameraPosition) {
}
}
void Head::addOrientation(float pitch, float yaw, float roll) {
if (_lookingInMirror) {
yaw = -yaw;
roll = -roll;
}
setOrientation(getOrientation() * glm::quat(glm::radians(glm::vec3(pitch, yaw, roll))));
}
void Head::setOrientation(const glm::quat& orientation) {
glm::vec3 eulerAngles = safeEulerAngles(glm::inverse(glm::quat(glm::radians(_bodyRotation))) * orientation);
if (_lookingInMirror) {
setPitch(eulerAngles.x);
setYaw(-eulerAngles.y);
setRoll(-eulerAngles.z);
} else {
setPitch(eulerAngles.x);
setYaw(eulerAngles.y);
setRoll(eulerAngles.z);
}
}
glm::quat Head::getOrientation() const {
return glm::quat(glm::radians(_bodyRotation)) * glm::quat(glm::radians(_lookingInMirror ?
glm::vec3(_pitch, -_yaw, -_roll) : glm::vec3(_pitch, _yaw, _roll)));

View file

@ -45,9 +45,6 @@ public:
void setAverageLoudness(float averageLoudness ) { _averageLoudness = averageLoudness; }
void setReturnToCenter (bool returnHeadToCenter) { _returnHeadToCenter = returnHeadToCenter; }
void setRenderLookatVectors(bool onOff ) { _renderLookatVectors = onOff; }
void setOrientation(const glm::quat& orientation);
void addOrientation(float pitch, float yaw, float roll);
glm::quat getOrientation() const;
glm::quat getWorldAlignedOrientation () const;