From 6f552b4a00495969c39026afe36494e1dd80ddf7 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Thu, 30 May 2013 16:26:15 -0700 Subject: [PATCH] Playing around with using the gyro acceleration to drive the eye offset. --- interface/src/Application.cpp | 7 +++++++ interface/src/Application.h | 1 + 2 files changed, 8 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 262bf6625a..e7b6ee1d80 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -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) { diff --git a/interface/src/Application.h b/interface/src/Application.h index 64959f1274..540ce1796e 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -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;