mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-24 10:04:30 +02:00
Fixing the avatar / HMD pose compisition for Oculus
This commit is contained in:
parent
3d2139691c
commit
00342d2c76
2 changed files with 6 additions and 4 deletions
|
@ -942,13 +942,13 @@ void Application::paintGL() {
|
||||||
// Using the latter will cause the camera to wobble with idle animations,
|
// Using the latter will cause the camera to wobble with idle animations,
|
||||||
// or with changes from the face tracker
|
// or with changes from the face tracker
|
||||||
|
|
||||||
|
_myCamera.setPosition(_myAvatar->getDefaultEyePosition());
|
||||||
if (!getActiveDisplayPlugin()->isHmd()) {
|
if (!getActiveDisplayPlugin()->isHmd()) {
|
||||||
_myCamera.setPosition(_myAvatar->getDefaultEyePosition());
|
|
||||||
_myCamera.setRotation(_myAvatar->getHead()->getCameraOrientation());
|
_myCamera.setRotation(_myAvatar->getHead()->getCameraOrientation());
|
||||||
} else {
|
} else {
|
||||||
auto camMat = _myAvatar->getSensorToWorldMatrix() * getHMDSensorPose();
|
// The plugin getModelview() call below will compose the base
|
||||||
_myCamera.setPosition(extractTranslation(camMat));
|
// avatar transform with the HMD pose.
|
||||||
_myCamera.setRotation(glm::quat_cast(camMat));
|
_myCamera.setRotation(_myAvatar->getOrientation());
|
||||||
}
|
}
|
||||||
} else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
} else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
||||||
if (isHMDMode()) {
|
if (isHMDMode()) {
|
||||||
|
|
|
@ -65,6 +65,8 @@ glm::mat4 OculusBaseDisplayPlugin::getEyePose(Eye eye) const {
|
||||||
return toGlm(_eyePoses[eye]);
|
return toGlm(_eyePoses[eye]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Should NOT be used for rendering as this will mess up timewarp. Use the getModelview() method above for
|
||||||
|
// any use of head poses for rendering, ensuring you use the correct eye
|
||||||
glm::mat4 OculusBaseDisplayPlugin::getHeadPose() const {
|
glm::mat4 OculusBaseDisplayPlugin::getHeadPose() const {
|
||||||
ovrTrackingState state = ovrHmd_GetTrackingState(_hmd, 0.0f);
|
ovrTrackingState state = ovrHmd_GetTrackingState(_hmd, 0.0f);
|
||||||
return toGlm(state.HeadPose.ThePose);
|
return toGlm(state.HeadPose.ThePose);
|
||||||
|
|
Loading…
Reference in a new issue