mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 07:23:39 +02:00
Revert to simply adding the Eulers.
This commit is contained in:
parent
47bf5a2b77
commit
9213cfd0c2
3 changed files with 3 additions and 28 deletions
|
@ -134,10 +134,9 @@ void Avatar::updateHeadFromGyros(float deltaTime, SerialInterface* serialInterfa
|
||||||
float measuredRollRate = serialInterface->getLastRollRate();
|
float measuredRollRate = serialInterface->getLastRollRate();
|
||||||
|
|
||||||
// Update avatar head position based on measured gyro rates
|
// Update avatar head position based on measured gyro rates
|
||||||
_head.addOrientation(
|
_head.addPitch(measuredPitchRate * AMPLIFY_PITCH * deltaTime);
|
||||||
measuredPitchRate * AMPLIFY_PITCH * deltaTime,
|
_head.addYaw(measuredYawRate * AMPLIFY_YAW * deltaTime);
|
||||||
measuredYawRate * AMPLIFY_YAW * deltaTime,
|
_head.addRoll(measuredRollRate * AMPLIFY_ROLL * deltaTime);
|
||||||
measuredRollRate * AMPLIFY_ROLL * deltaTime);
|
|
||||||
|
|
||||||
// Update head lean distance based on accelerometer data
|
// Update head lean distance based on accelerometer data
|
||||||
glm::vec3 headRotationRates(_head.getPitch(), _head.getYaw(), _head.getRoll());
|
glm::vec3 headRotationRates(_head.getPitch(), _head.getYaw(), _head.getRoll());
|
||||||
|
|
|
@ -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 {
|
glm::quat Head::getOrientation() const {
|
||||||
return glm::quat(glm::radians(_bodyRotation)) * glm::quat(glm::radians(_lookingInMirror ?
|
return glm::quat(glm::radians(_bodyRotation)) * glm::quat(glm::radians(_lookingInMirror ?
|
||||||
glm::vec3(_pitch, -_yaw, -_roll) : glm::vec3(_pitch, _yaw, _roll)));
|
glm::vec3(_pitch, -_yaw, -_roll) : glm::vec3(_pitch, _yaw, _roll)));
|
||||||
|
|
|
@ -45,9 +45,6 @@ public:
|
||||||
void setAverageLoudness(float averageLoudness ) { _averageLoudness = averageLoudness; }
|
void setAverageLoudness(float averageLoudness ) { _averageLoudness = averageLoudness; }
|
||||||
void setReturnToCenter (bool returnHeadToCenter) { _returnHeadToCenter = returnHeadToCenter; }
|
void setReturnToCenter (bool returnHeadToCenter) { _returnHeadToCenter = returnHeadToCenter; }
|
||||||
void setRenderLookatVectors(bool onOff ) { _renderLookatVectors = onOff; }
|
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 getOrientation() const;
|
||||||
glm::quat getWorldAlignedOrientation () const;
|
glm::quat getWorldAlignedOrientation () const;
|
||||||
|
|
Loading…
Reference in a new issue