mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 23:43:18 +02:00
drive body yaw and render pitch with oculus when connected
This commit is contained in:
parent
adbca70eba
commit
04447dfcbd
2 changed files with 16 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue