drive body yaw and render pitch with oculus when connected

This commit is contained in:
Stephen Birarda 2013-05-10 10:17:21 -07:00
parent adbca70eba
commit 04447dfcbd
2 changed files with 16 additions and 2 deletions

View file

@ -7,6 +7,7 @@
#include <SharedUtil.h>
#include <VoxelConstants.h>
#include <OculusManager.h>
// #include "Log.h"
#include "Camera.h"
@ -69,8 +70,14 @@ void Camera::updateFollowMode(float deltaTime) {
t = 1.0;
}
// update _yaw (before position!)
_yaw += (_idealYaw - _yaw) * t;
// update _yaw (before position!)
if (OculusManager::isConnected()) {
// if using the oculus, just set the yaw
_yaw = _idealYaw;
} else {
_yaw += (_idealYaw - _yaw) * t;
}
_orientation.yaw(_yaw);
float radian = (_yaw / 180.0) * PIE;

View file

@ -425,6 +425,13 @@ void updateAvatar(float deltaTime) {
myAvatar.setRenderPitch(myAvatar.getRenderPitch() * (1.f - RENDER_PITCH_DECAY * deltaTime));
}
if (OculusManager::isConnected()) {
float yaw, pitch, roll;
OculusManager::getEulerAngles(yaw, pitch, roll);
myAvatar.setBodyYaw(yaw);
myAvatar.setRenderPitch(pitch);
}
// Get audio loudness data from audio input device
#ifndef _WIN32
myAvatar.setLoudness(audio.getInputLoudness());