mirror of
https://github.com/overte-org/overte.git
synced 2025-04-26 16:36:18 +02:00
Attempt to use Faceshift eye data to deflect the default eye behavior.
This commit is contained in:
parent
6f53701095
commit
e4bf5358eb
1 changed files with 19 additions and 24 deletions
|
@ -1941,33 +1941,28 @@ void Application::update(float deltaTime) {
|
||||||
_myAvatar.getHead().setAngularVelocity(_faceshift.getHeadAngularVelocity());
|
_myAvatar.getHead().setAngularVelocity(_faceshift.getHeadAngularVelocity());
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we have faceshift, use that to compute the lookat direction
|
|
||||||
glm::vec3 lookAtRayOrigin = mouseRayOrigin, lookAtRayDirection = mouseRayDirection;
|
|
||||||
if (_faceshift.isActive()) {
|
|
||||||
lookAtRayOrigin = _myAvatar.getHead().calculateAverageEyePosition();
|
|
||||||
lookAtRayDirection = _myAvatar.getHead().getOrientation() * glm::quat(glm::radians(glm::vec3(
|
|
||||||
_faceshift.getEstimatedEyePitch(), _faceshift.getEstimatedEyeYaw(), 0.0f))) * glm::vec3(0.0f, 0.0f, -1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, lookAtSpot);
|
updateLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, lookAtSpot);
|
||||||
if (_lookatTargetAvatar && !_faceshift.isActive()) {
|
if (!_lookatTargetAvatar) {
|
||||||
// If the mouse is over another avatar's head...
|
if (_isHoverVoxel) {
|
||||||
_myAvatar.getHead().setLookAtPosition(lookAtSpot);
|
|
||||||
|
|
||||||
} else if (_isHoverVoxel && !_faceshift.isActive()) {
|
|
||||||
// Look at the hovered voxel
|
// Look at the hovered voxel
|
||||||
lookAtSpot = getMouseVoxelWorldCoordinates(_hoverVoxel);
|
lookAtSpot = getMouseVoxelWorldCoordinates(_hoverVoxel);
|
||||||
_myAvatar.getHead().setLookAtPosition(lookAtSpot);
|
|
||||||
|
|
||||||
} else if (_myCamera.getMode() == CAMERA_MODE_MIRROR && !_faceshift.isActive()) {
|
} else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
|
||||||
_myAvatar.getHead().setLookAtPosition(_myCamera.getPosition());
|
lookAtSpot = _myCamera.getPosition();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Just look in direction of the mouse ray
|
// Just look in direction of the mouse ray
|
||||||
const float FAR_AWAY_STARE = TREE_SCALE;
|
const float FAR_AWAY_STARE = TREE_SCALE;
|
||||||
lookAtSpot = lookAtRayOrigin + lookAtRayDirection * FAR_AWAY_STARE;
|
lookAtSpot = mouseRayOrigin + mouseRayDirection * FAR_AWAY_STARE;
|
||||||
_myAvatar.getHead().setLookAtPosition(lookAtSpot);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (_faceshift.isActive()) {
|
||||||
|
glm::vec3 origin = _myAvatar.getHead().calculateAverageEyePosition();
|
||||||
|
lookAtSpot = origin + _myCamera.getRotation() * _faceshift.getHeadRotation() * glm::quat(glm::radians(glm::vec3(
|
||||||
|
_faceshift.getEstimatedEyePitch(), _faceshift.getEstimatedEyeYaw(), 0.0f))) *
|
||||||
|
glm::inverse(_myCamera.getRotation()) * (lookAtSpot - origin);
|
||||||
|
}
|
||||||
|
_myAvatar.getHead().setLookAtPosition(lookAtSpot);
|
||||||
|
|
||||||
// Find the voxel we are hovering over, and respond if clicked
|
// Find the voxel we are hovering over, and respond if clicked
|
||||||
float distance;
|
float distance;
|
||||||
|
|
Loading…
Reference in a new issue