This commit is contained in:
Andrzej Kapolka 2013-05-23 09:52:30 -07:00
commit 1878ac8610
5 changed files with 12 additions and 15 deletions

View file

@ -303,8 +303,8 @@ void Application::paintGL() {
_myCamera.setTightness (100.0f);
_myCamera.setTargetPosition(_myAvatar.getHeadPosition());
_myCamera.setTargetRotation(_myAvatar.getAbsoluteHeadYaw(),
-_myAvatar.getHead().getPitch(),
_myAvatar.getHead().getRoll());
_myAvatar.getHead().getPitch(),
-_myAvatar.getHead().getRoll());
} else if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
_myCamera.setTargetPosition(_myAvatar.getSpringyHeadPosition());
_myCamera.setTargetRotation(_myAvatar.getAbsoluteHeadYaw(),
@ -1365,7 +1365,7 @@ void Application::updateAvatar(float deltaTime) {
const float VERTICAL_PIXELS_PER_DEGREE = 1800.f / 30.f;
if (powf(measuredYawRate * measuredYawRate +
measuredPitchRate * measuredPitchRate, 0.5) > MIN_MOUSE_RATE) {
_headMouseX += measuredYawRate * HORIZONTAL_PIXELS_PER_DEGREE * deltaTime;
_headMouseX -= measuredYawRate * HORIZONTAL_PIXELS_PER_DEGREE * deltaTime;
_headMouseY -= measuredPitchRate * VERTICAL_PIXELS_PER_DEGREE * deltaTime;
}
_headMouseX = max(_headMouseX, 0);
@ -1377,7 +1377,7 @@ void Application::updateAvatar(float deltaTime) {
float yaw, pitch, roll;
OculusManager::getEulerAngles(yaw, pitch, roll);
_myAvatar.getHead().setYaw(-yaw);
_myAvatar.getHead().setYaw(yaw);
_myAvatar.getHead().setPitch(pitch);
_myAvatar.getHead().setRoll(roll);
}

View file

@ -143,8 +143,7 @@ void Avatar::updateHeadFromGyros(float deltaTime, SerialInterface* serialInterfa
// Update head lean distance based on accelerometer data
glm::vec3 headRotationRates(_head.getPitch(), _head.getYaw(), _head.getRoll());
glm::vec3 leaning = (serialInterface->getLastAcceleration() - serialInterface->getGravity())
glm::vec3 leaning = (serialInterface->getLastAcceleration() - serialInterface->getGravity())
* LEAN_SENSITIVITY
* (1.f - fminf(glm::length(headRotationRates), HEAD_RATE_MAX) / HEAD_RATE_MAX);
leaning.y = 0.f;

View file

@ -131,12 +131,12 @@ void Head::calculateGeometry(bool lookingInMirror) {
//generate orientation directions based on Euler angles...
float pitch = _pitch;
float yaw = -_yaw;
float roll = -_roll;
float yaw = _yaw;
float roll = _roll;
if (lookingInMirror) {
yaw = _yaw;
roll = _roll;
yaw = -_yaw;
roll = -_roll;
}
_orientation.setToIdentity();
@ -210,8 +210,6 @@ void Head::renderEars() {
glPopMatrix();
}
void Head::renderMouth() {
float s = sqrt(_averageLoudness);

View file

@ -38,7 +38,7 @@ void OculusManager::connect() {
void OculusManager::getEulerAngles(float& yaw, float& pitch, float& roll) {
#ifdef __APPLE__
_sensorFusion.GetOrientation().GetEulerAngles<Axis_Y, Axis_X, Axis_Z, Rotate_CW, Handed_R>(&yaw, &pitch, &roll);
_sensorFusion.GetOrientation().GetEulerAngles<Axis_Y, Axis_X, Axis_Z, Rotate_CCW, Handed_R>(&yaw, &pitch, &roll);
// convert each angle to degrees
yaw = glm::degrees(yaw);

View file

@ -203,8 +203,8 @@ void SerialInterface::readData() {
// Convert the integer rates to floats
const float LSB_TO_DEGREES_PER_SECOND = 1.f / 16.4f; // From MPU-9150 register map, 2000 deg/sec.
_lastRollRate = ((float) rollRate) * LSB_TO_DEGREES_PER_SECOND;
_lastYawRate = ((float) yawRate) * LSB_TO_DEGREES_PER_SECOND;
_lastRollRate = ((float) -rollRate) * LSB_TO_DEGREES_PER_SECOND;
_lastYawRate = ((float) -yawRate) * LSB_TO_DEGREES_PER_SECOND;
_lastPitchRate = ((float) -pitchRate) * LSB_TO_DEGREES_PER_SECOND;
// Accumulate a set of initial baseline readings for setting gravity