Showing the changes to interface/src/Application.cpp (1 of 3 files). Show all
Unified · Split
| @@ -2371,11 +2371,19 @@ void Application::updateMyAvatarLookAtPosition() { · 2370 unmodified lines | |||
| 2371 | } else { | 2371 | } else { |
| 2372 | lookAtSpot = _myCamera.getPosition() + transformPoint(_myAvatar->getSensorToWorldMatrix(), extractTranslation(getHMDSensorPose())); | 2372 | lookAtSpot = _myCamera.getPosition() + transformPoint(_myAvatar->getSensorToWorldMatrix(), extractTranslation(getHMDSensorPose())); |
| 2373 | } | 2373 | } |
| 2374 | } else if (eyeTracker->isTracking() && (OculusManager::isConnected() || eyeTracker->isSimulating())) { | 2374 | } else if (eyeTracker->isTracking() && (isHMDMode() || eyeTracker->isSimulating())) { |
| 2375 | // Look at the point that the user is looking at. | 2375 | // Look at the point that the user is looking at. |
| 2376 | if (OculusManager::isConnected()) { | 2376 | if (isHMDMode()) { |
| 2377 | lookAtSpot = _myCamera.getPosition() + OculusManager::getMidEyePosition() + | 2377 | |
| 2378 | _myAvatar->getOrientation() * (OculusManager::getOrientation() * eyeTracker->getLookAtPosition()); | 2378 | // TODO: Test ... |
| 2379 | // Position of simulated look-at target should change with change in HMD position and orientation | ||
| 2380 | |||
| 2381 | glm::mat4 headPose = getActiveDisplayPlugin()->getHeadPose(); | ||
| 2382 | glm::quat hmdOrientation = glm::quat_cast(headPose); | ||
| 2383 | glm::vec3 hmdPosition = glm::vec3(headPose[3]); | ||
| 2384 | |||
| 2385 | lookAtSpot = _myCamera.getPosition() + hmdPosition + | ||
| 2386 | _myAvatar->getOrientation() * (hmdOrientation * eyeTracker->getLookAtPosition()); | ||
| 2379 | } else { | 2387 | } else { |
| 2380 | lookAtSpot = _myAvatar->getHead()->getEyePosition() + | 2388 | lookAtSpot = _myAvatar->getHead()->getEyePosition() + |
| 2381 | (_myAvatar->getHead()->getFinalOrientationInWorldFrame() * eyeTracker->getLookAtPosition()); | 2389 | (_myAvatar->getHead()->getFinalOrientationInWorldFrame() * eyeTracker->getLookAtPosition()); |
| @@ -2412,9 +2420,17 @@ void Application::updateMyAvatarLookAtPosition() { · 30 unmodified lines | |||
| 2412 | } | 2420 | } |
| 2413 | } else { | 2421 | } else { |
| 2414 | // I am not looking at anyone else, so just look forward | 2422 | // I am not looking at anyone else, so just look forward |
| 2415 | if (OculusManager::isConnected()) { | 2423 | if (isHMDMode()) { |
| 2416 | lookAtSpot = _myCamera.getPosition() + OculusManager::getMidEyePosition() + | 2424 | |
| 2417 | _myAvatar->getOrientation() * (OculusManager::getOrientation() * glm::vec3(0.0f, 0.0f, -TREE_SCALE)); | 2425 | // TODO: Test ... |
| 2426 | // Look-at vector should go into distance based on HMD position and orientation | ||
| 2427 | |||
| 2428 | glm::mat4 headPose = getActiveDisplayPlugin()->getHeadPose(); | ||
| 2429 | glm::quat hmdOrientation = glm::quat_cast(headPose); | ||
| 2430 | glm::vec3 hmdPosition = glm::vec3(headPose[3]); | ||
| 2431 | |||
| 2432 | lookAtSpot = _myCamera.getPosition() + hmdPosition + | ||
| 2433 | _myAvatar->getOrientation() * (hmdOrientation * glm::vec3(0.0f, 0.0f, -TREE_SCALE)); | ||
| 2418 | } else { | 2434 | } else { |
| 2419 | lookAtSpot = _myAvatar->getHead()->getEyePosition() + | 2435 | lookAtSpot = _myAvatar->getHead()->getEyePosition() + |
| 2420 | (_myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.0f, 0.0f, -TREE_SCALE)); | 2436 | (_myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.0f, 0.0f, -TREE_SCALE)); |