mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 09:24:00 +02:00
Add condition to updateAvatar() where if another avatar's head is at
the center of the screen, the lookAtPosition is set to the eye level of that avatar.
This commit is contained in:
parent
3909217815
commit
f145a1eac4
1 changed files with 11 additions and 0 deletions
|
@ -2016,6 +2016,17 @@ void Application::updateAvatar(float deltaTime) {
|
|||
_headMouseY = max(_headMouseY, 0);
|
||||
_headMouseY = min(_headMouseY, _glWidget->height());
|
||||
|
||||
// Set lookAtPosition if an avatar is at the center of the screen
|
||||
|
||||
glm::vec3 screenCenterRayOrigin, screenCenterRayDirection;
|
||||
_viewFrustum.computePickRay(0.5, 0.5, screenCenterRayOrigin, screenCenterRayDirection);
|
||||
|
||||
glm::vec3 eyePosition;
|
||||
if (isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition)) {
|
||||
glm::vec3 myLookAtFromMouse(eyePosition);
|
||||
_myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (OculusManager::isConnected()) {
|
||||
|
|
Loading…
Reference in a new issue