History

Proper mirror and third person mode in Oculus

barnold1953 committed 12 years ago

Commit d109ef61 parent 508fed95 files · +74 −49Browse files

Showing the changes to interface/src/Application.cpp (1 of 5 files). Show all

Unified · Split

interface/src/Application.cpp+8−14
@@ -582,8 +582,8 @@ void Application::paintGL() { · 581 unmodified lines
582582
583583 } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
584584 _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing
585− _myCamera.setTargetPosition(_myAvatar->getUprightHeadPosition());
586− _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation());
585+ _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition());
586+ _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation());
587587
588588 } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
589589 _myCamera.setTightness(0.0f);
@@ -594,17 +594,6 @@ void Application::paintGL() { · 4 unmodified lines
594594 _myCamera.setTargetRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
595595 }
596596
597− if (OculusManager::isConnected()) {
598− // Oculus in third person causes nausea, so only allow it if option is checked in dev menu
599− if (!Menu::getInstance()->isOptionChecked(MenuOption::AllowOculusCameraModeChange) || _myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
600− _myCamera.setDistance(0.0f);
601− _myCamera.setTargetPosition(_myAvatar->getHead()->calculateAverageEyePosition());
602− _myCamera.setTargetRotation(_myAvatar->getHead()->getCameraOrientation());
603− }
604− _myCamera.setUpShift(0.0f);
605− _myCamera.setTightness(0.0f); // Camera is directly connected to head without smoothing
606− }
607−
608597 // Update camera position
609598 _myCamera.update( 1.f/_fps );
610599
@@ -638,7 +627,12 @@ void Application::paintGL() { · 27 unmodified lines
638627 }
639628
640629 if (OculusManager::isConnected()) {
641− OculusManager::display(_myAvatar->getOrientation(), whichCamera);
630+ //When in mirror mode, use camera rotation. Otherwise, use body rotation
631+ if (whichCamera.getMode() == CAMERA_MODE_MIRROR) {
632+ OculusManager::display(whichCamera.getRotation(), whichCamera.getPosition(), whichCamera);
633+ } else {
634+ OculusManager::display(_myAvatar->getWorldAlignedOrientation(), whichCamera.getPosition(), whichCamera);
635+ }
642636
643637 } else if (TV3DManager::isConnected()) {
644638 _glowEffect.prepare();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t