Added "Gyro Eye Offset" menu option to drive the eye offset from the gyros.

This commit is contained in:
Andrzej Kapolka 2013-05-30 16:34:59 -07:00
parent 6f552b4a00
commit ffb3cf53aa
2 changed files with 11 additions and 5 deletions

View file

@ -299,11 +299,13 @@ void Application::paintGL() {
} else if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
_myCamera.setTargetPosition(_myAvatar.getSpringyHeadPosition());
_myCamera.setTargetRotation(_myAvatar.getHead().getWorldAlignedOrientation());
_myCamera.setTargetRotation(_gyroEyeOffset->isChecked() ? _myAvatar.getWorldAlignedOrientation() :
_myAvatar.getHead().getWorldAlignedOrientation());
} else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
_myCamera.setTargetPosition(_myAvatar.getHeadPosition());
_myCamera.setTargetRotation(_myAvatar.getHead().getWorldAlignedOrientation());
_myCamera.setTargetRotation(_gyroEyeOffset->isChecked() ? _myAvatar.getWorldAlignedOrientation() :
_myAvatar.getHead().getWorldAlignedOrientation());
}
// important...
@ -1124,6 +1126,7 @@ void Application::initMenu() {
optionsMenu->addAction("Noise", this, SLOT(setNoise(bool)), Qt::Key_N)->setCheckable(true);
(_gyroLook = optionsMenu->addAction("Gyro Look"))->setCheckable(true);
_gyroLook->setChecked(true);
(_gyroEyeOffset = optionsMenu->addAction("Gyro Eye Offset"))->setCheckable(true);
(_mouseLook = optionsMenu->addAction("Mouse Look"))->setCheckable(true);
_mouseLook->setChecked(false);
(_showHeadMouse = optionsMenu->addAction("Head Mouse"))->setCheckable(true);
@ -1294,9 +1297,11 @@ 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 (_gyroEyeOffset->isChecked()) {
_eyeOffsetVelocity += _serialPort.getLastAcceleration() * deltaTime;
_myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + _eyeOffsetVelocity * deltaTime);
resizeGL(_glWidget->width(), _glWidget->height());
}
if (OculusManager::isConnected()) {
float yaw, pitch, roll;

View file

@ -143,6 +143,7 @@ private:
QAction* _lookingInMirror; // Are we currently rendering one's own head as if in mirror?
QAction* _echoAudioMode; // Are we asking the mixer to echo back our audio?
QAction* _gyroLook; // Whether to allow the gyro data from head to move your view
QAction* _gyroEyeOffset; // Whether to allow the gyro data to move your eye offset
QAction* _mouseLook; // Whether the have the mouse near edge of screen move your view
QAction* _showHeadMouse; // Whether the have the mouse near edge of screen move your view
QAction* _transmitterDrives; // Whether to have Transmitter data move/steer the Avatar