Showing the changes to interface/src/Application.cpp (1 of 11 files). Show all
Unified · Split
| @@ -2254,7 +2254,7 @@ Avatar* Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3 · 2253 unmodified lines | ||
| 2254 | 2254 | if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { |
| 2255 | 2255 | Avatar* avatar = (Avatar *) node->getLinkedData(); |
| 2256 | 2256 | glm::vec3 headPosition = avatar->getHead().getPosition(); |
| 2257 | − if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) { | |
| 2257 | + if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS * avatar->getScale())) { | |
| 2258 | 2258 | eyePosition = avatar->getHead().getEyePosition(); |
| 2259 | 2259 | _lookatIndicatorScale = avatar->getScale(); |
| 2260 | 2260 | _lookatOtherPosition = headPosition; |
| @@ -2266,6 +2266,16 @@ Avatar* Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3 · 5 unmodified lines | ||
| 2266 | 2266 | return NULL; |
| 2267 | 2267 | } |
| 2268 | 2268 | |
| 2269 | +bool Application::isLookingAtMyAvatar(Avatar* avatar) { | |
| 2270 | + glm::vec3 theirLookat = avatar->getHead().getLookAtPosition(); | |
| 2271 | + glm::vec3 myHeadPosition = _myAvatar.getHead().getPosition(); | |
| 2272 | + | |
| 2273 | + if (pointInSphere(theirLookat, myHeadPosition, HEAD_SPHERE_RADIUS * _myAvatar.getScale())) { | |
| 2274 | + return true; | |
| 2275 | + } | |
| 2276 | + return false; | |
| 2277 | +} | |
| 2278 | + | |
| 2269 | 2279 | void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) { |
| 2270 | 2280 | |
| 2271 | 2281 | const float DISTANCE_FROM_HEAD_SPHERE = 0.1f * _lookatIndicatorScale; |
| @@ -3015,6 +3025,9 @@ void Application::displaySide(Camera& whichCamera) { · 743 unmodified lines | ||
| 3015 | 3025 | if (!avatar->isInitialized()) { |
| 3016 | 3026 | avatar->init(); |
| 3017 | 3027 | } |
| 3028 | + if (isLookingAtMyAvatar(avatar)) { | |
| 3029 | + avatar->getHead().setLookAtPosition(_myCamera.getPosition()); | |
| 3030 | + } | |
| 3018 | 3031 | avatar->render(false, _renderAvatarBalls->isChecked()); |
| 3019 | 3032 | avatar->setDisplayingLookatVectors(_renderLookatOn->isChecked()); |
| 3020 | 3033 | } |