History

Merge pull request #4768 from jherico/track-camera

Remove camera wobble caused by having a face tracker enabled

Philip Rosedale committed 11 years ago

Commit d52d3512 parents 457ae5b dc1b5a21 file · +9 −4Browse files

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

Unified · Split

interface/src/Application.cpp+9−4
@@ -824,13 +824,18 @@ void Application::paintGL() { · 823 unmodified lines
824824 glEnable(GL_LINE_SMOOTH);
825825
826826 if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
827+ // Always use the default eye position, not the actual head eye position.
828+ // Using the latter will cause the camera to wobble with idle animations,
829+ // or with changes from the face tracker
830+ _myCamera.setPosition(_myAvatar->getDefaultEyePosition());
827831 if (!OculusManager::isConnected()) {
828− // If there isn't an HMD, match exactly to avatar's head
829− _myCamera.setPosition(_myAvatar->getHead()->getEyePosition());
832+ // If not using an HMD, grab the camera orientation directly
830833 _myCamera.setRotation(_myAvatar->getHead()->getCameraOrientation());
831834 } else {
832− // For an HMD, set the base position and orientation to that of the avatar body
833− _myCamera.setPosition(_myAvatar->getDefaultEyePosition());
835+ // In an HMD, people can look up and down with their actual neck, and the
836+ // per-eye HMD pose will be applied later. So set the camera orientation
837+ // to only the yaw, excluding pitch and roll, i.e. an orientation that
838+ // is orthongonal to the (body's) Y axis
834839 _myCamera.setRotation(_myAvatar->getWorldAlignedOrientation());
835840 }
836841