Playing around with using the gyro acceleration to drive the eye offset.

This commit is contained in:
Andrzej Kapolka 2013-05-30 16:26:15 -07:00
parent 97343edfca
commit 6f552b4a00
2 changed files with 8 additions and 0 deletions

View file

@ -1294,6 +1294,10 @@ void Application::updateAvatar(float deltaTime) {
_headMouseY = max(_headMouseY, 0);
_headMouseY = min(_headMouseY, _glWidget->height());
_eyeOffsetVelocity += _serialPort.getLastAcceleration() * deltaTime;
_myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + _eyeOffsetVelocity * deltaTime);
resizeGL(_glWidget->width(), _glWidget->height());
if (OculusManager::isConnected()) {
float yaw, pitch, roll;
OculusManager::getEulerAngles(yaw, pitch, roll);
@ -2086,6 +2090,9 @@ void Application::resetSensors() {
QCursor::setPos(_headMouseX, _headMouseY);
_myAvatar.reset();
_myTransmitter.resetLevels();
_myCamera.setEyeOffsetPosition(glm::vec3(0.0f, 0.0f, 0.0f));
_eyeOffsetVelocity = glm::vec3(0.0f, 0.0f, 0.0f);
resizeGL(_glWidget->width(), _glWidget->height());
}
static void setShortcutsEnabled(QWidget* widget, bool enabled) {

View file

@ -206,6 +206,7 @@ private:
Camera _myCamera; // My view onto the world
Camera _viewFrustumOffsetCamera; // The camera we use to sometimes show the view frustum from an offset mode
glm::vec3 _eyeOffsetVelocity;
Environment _environment;