Fix eyePosition so that lookatVectors point directly to eyes,
Showing the changes to interface/src/Application.cpp (1 of 3 files). Show all
Unified · Split
| @@ -203,6 +203,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 202 unmodified lines | ||
| 203 | 203 | _mouseVoxelScale(1.0f / 1024.0f), |
| 204 | 204 | _justEditedVoxel(false), |
| 205 | 205 | _isLookingAtOtherAvatar(false), |
| 206 | + _lookatIndicatorScale(1.0f), | |
| 206 | 207 | _paintOn(false), |
| 207 | 208 | _dominantColor(0), |
| 208 | 209 | _perfStatsOn(false), |
| @@ -1993,6 +1994,7 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 1784 unmodified lines | ||
| 1993 | 1994 | glm::vec3 headPosition = avatar->getHead().getPosition(); |
| 1994 | 1995 | if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) { |
| 1995 | 1996 | eyePosition = avatar->getHead().getEyeLevelPosition(); |
| 1997 | + _lookatIndicatorScale = avatar->getScale(); | |
| 1996 | 1998 | _lookatOtherPosition = headPosition; |
| 1997 | 1999 | nodeID = avatar->getOwningNode()->getNodeID(); |
| 1998 | 2000 | return true; |
| @@ -2004,11 +2006,13 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 5 unmodified lines | ||
| 2004 | 2006 | |
| 2005 | 2007 | void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) { |
| 2006 | 2008 | |
| 2007 | − const float DISTANCE_FROM_HEAD_SPHERE = 0.1f; | |
| 2009 | + const float DISTANCE_FROM_HEAD_SPHERE = 0.1f * _lookatIndicatorScale; | |
| 2010 | + const float INDICATOR_RADIUS = 0.1f * _lookatIndicatorScale; | |
| 2008 | 2011 | const float YELLOW[] = { 1.0f, 1.0f, 0.0f }; |
| 2012 | + const int NUM_SEGMENTS = 30; | |
| 2009 | 2013 | glm::vec3 haloOrigin(pointOfInterest.x, pointOfInterest.y + DISTANCE_FROM_HEAD_SPHERE, pointOfInterest.z); |
| 2010 | 2014 | glColor3f(YELLOW[0], YELLOW[1], YELLOW[2]); |
| 2011 | − renderCircle(haloOrigin, 0.1f, glm::vec3(0.0f, 1.0f, 0.0f), 30); | |
| 2015 | + renderCircle(haloOrigin, INDICATOR_RADIUS, IDENTITY_UP, NUM_SEGMENTS); | |
| 2012 | 2016 | } |
| 2013 | 2017 | |
| 2014 | 2018 | void Application::update(float deltaTime) { |
| @@ -2057,7 +2061,7 @@ void Application::update(float deltaTime) { · 42 unmodified lines | ||
| 2057 | 2061 | glm::vec3 front = orientation * IDENTITY_FRONT; |
| 2058 | 2062 | glm::vec3 up = orientation * IDENTITY_UP; |
| 2059 | 2063 | glm::vec3 towardVoxel = getMouseVoxelWorldCoordinates(_mouseVoxelDragging) |
| 2060 | − - _myAvatar.getCameraPosition(); // is this an error? getCameraPosition dne | |
| 2064 | + - _myAvatar.getCameraPosition(); | |
| 2061 | 2065 | towardVoxel = front * glm::length(towardVoxel); |
| 2062 | 2066 | glm::vec3 lateralToVoxel = glm::cross(up, glm::normalize(towardVoxel)) * glm::length(towardVoxel); |
| 2063 | 2067 | _voxelThrust = glm::vec3(0, 0, 0); |
| @@ -2335,7 +2339,7 @@ void Application::updateAvatar(float deltaTime) { · 271 unmodified lines | ||
| 2335 | 2339 | // actually need to calculate the view frustum planes to send these details |
| 2336 | 2340 | // to the server. |
| 2337 | 2341 | loadViewFrustum(_myCamera, _viewFrustum); |
| 2338 | − _myAvatar.setCameraPosition(_viewFrustum.getPosition()); // setCameraPosition() dne | |
| 2342 | + _myAvatar.setCameraPosition(_viewFrustum.getPosition()); | |
| 2339 | 2343 | _myAvatar.setCameraOrientation(_viewFrustum.getOrientation()); |
| 2340 | 2344 | _myAvatar.setCameraFov(_viewFrustum.getFieldOfView()); |
| 2341 | 2345 | _myAvatar.setCameraAspectRatio(_viewFrustum.getAspectRatio()); |