mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Fix HMD look-at positions and lines
This commit is contained in:
parent
c060af0de5
commit
0f56285283
2 changed files with 17 additions and 29 deletions
|
@ -2374,16 +2374,10 @@ void Application::updateMyAvatarLookAtPosition() {
|
|||
} else if (eyeTracker->isTracking() && (isHMDMode() || eyeTracker->isSimulating())) {
|
||||
// Look at the point that the user is looking at.
|
||||
if (isHMDMode()) {
|
||||
|
||||
// TODO: Test ...
|
||||
// Position of simulated look-at target should change with change in HMD position and orientation
|
||||
|
||||
glm::mat4 headPose = getActiveDisplayPlugin()->getHeadPose();
|
||||
glm::quat hmdOrientation = glm::quat_cast(headPose);
|
||||
glm::vec3 hmdPosition = glm::vec3(headPose[3]);
|
||||
|
||||
lookAtSpot = _myCamera.getPosition() + hmdPosition +
|
||||
_myAvatar->getOrientation() * (hmdOrientation * eyeTracker->getLookAtPosition());
|
||||
glm::quat hmdRotation = glm::quat_cast(headPose);
|
||||
lookAtSpot = _myCamera.getPosition() +
|
||||
_myAvatar->getOrientation() * (hmdRotation * eyeTracker->getLookAtPosition());
|
||||
} else {
|
||||
lookAtSpot = _myAvatar->getHead()->getEyePosition() +
|
||||
(_myAvatar->getHead()->getFinalOrientationInWorldFrame() * eyeTracker->getLookAtPosition());
|
||||
|
@ -2421,16 +2415,10 @@ void Application::updateMyAvatarLookAtPosition() {
|
|||
} else {
|
||||
// I am not looking at anyone else, so just look forward
|
||||
if (isHMDMode()) {
|
||||
|
||||
// TODO: Test ...
|
||||
// Look-at vector should go into distance based on HMD position and orientation
|
||||
|
||||
glm::mat4 headPose = getActiveDisplayPlugin()->getHeadPose();
|
||||
glm::quat hmdOrientation = glm::quat_cast(headPose);
|
||||
glm::vec3 hmdPosition = glm::vec3(headPose[3]);
|
||||
|
||||
lookAtSpot = _myCamera.getPosition() + hmdPosition +
|
||||
_myAvatar->getOrientation() * (hmdOrientation * glm::vec3(0.0f, 0.0f, -TREE_SCALE));
|
||||
glm::quat headRotation = glm::quat_cast(headPose);
|
||||
lookAtSpot = _myCamera.getPosition() +
|
||||
_myAvatar->getOrientation() * (headRotation * glm::vec3(0.0f, 0.0f, -TREE_SCALE));
|
||||
} else {
|
||||
lookAtSpot = _myAvatar->getHead()->getEyePosition() +
|
||||
(_myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.0f, 0.0f, -TREE_SCALE));
|
||||
|
|
|
@ -1254,18 +1254,18 @@ void MyAvatar::renderBody(RenderArgs* renderArgs, ViewFrustum* renderFrustum, fl
|
|||
}
|
||||
|
||||
if (qApp->isHMDMode()) {
|
||||
|
||||
// TODO: Test ...
|
||||
// Look-at vectors should go from HMD mid eyes regardless of combined position and orientation
|
||||
|
||||
glm::mat4 leftEye = Application::getInstance()->getActiveDisplayPlugin()->getEyePose(Eye::Left);
|
||||
glm::vec3 leftEyePosition = glm::vec3(leftEye[3]);
|
||||
glm::mat4 rightEye = Application::getInstance()->getActiveDisplayPlugin()->getEyePose(Eye::Right);
|
||||
glm::vec3 rightEyePosition = glm::vec3(leftEye[3]);
|
||||
|
||||
glm::vec3 cameraPosition = Application::getInstance()->getCamera()->getPosition();
|
||||
getHead()->renderLookAts(renderArgs, cameraPosition + leftEyePosition,
|
||||
cameraPosition + rightEyePosition);
|
||||
|
||||
glm::mat4 leftEyePose = Application::getInstance()->getActiveDisplayPlugin()->getEyePose(Eye::Left);
|
||||
glm::vec3 leftEyePosition = glm::vec3(leftEyePose[3]);
|
||||
glm::mat4 rightEyePose = Application::getInstance()->getActiveDisplayPlugin()->getEyePose(Eye::Right);
|
||||
glm::vec3 rightEyePosition = glm::vec3(rightEyePose[3]);
|
||||
glm::mat4 headPose = Application::getInstance()->getActiveDisplayPlugin()->getHeadPose();
|
||||
glm::vec3 headPosition = glm::vec3(headPose[3]);
|
||||
|
||||
getHead()->renderLookAts(renderArgs,
|
||||
cameraPosition + getOrientation() * (leftEyePosition - headPosition),
|
||||
cameraPosition + getOrientation() * (rightEyePosition - headPosition));
|
||||
} else {
|
||||
getHead()->renderLookAts(renderArgs);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue