History

fixed a bug in avatar head lookat direction

Jeffrey Ventrella committed 13 years ago

Commit ab8140e1 parent 861108b5 files · +103 −12Browse files

Showing the changes to interface/src/main.cpp (1 of 5 files). Show all

Unified · Split

interface/src/main.cpp+35−2
@@ -511,6 +511,9 @@ void simulateHead(float frametime) · 510 unmodified lines
511511 }
512512 }
513513
514+
515+
516+
514517 // XXXBHG - this code is not yet working. This is here to help Jeffery debug getAvatarHeadLookatDirection()
515518 // The code will draw a yellow line from the avatar's position to the origin,
516519 // It also attempts to draw a cyan line from the avatar to 2 meters in front of the avatar in the direction
@@ -528,7 +531,35 @@ void render_view_frustum() { · 11 unmodified lines
528531 // farDist – the distance from the camera to the far plane
529532 // farHeight – the height of the far plane
530533 // farWidth – the width of the far plane
534+
535+
536+//Jeffrey's variation:
537+glm::vec3 avatarBodyPosition = myHead.getAvatarPosition();
538+glm::vec3 avatarHeadPosition = myHead.getAvatarHeadPosition();
539+glm::vec3 avatarHeadDirection = myHead.getAvatarHeadLookatDirection();
540+
541+glm::vec3 avatarHeadDirectionEndPoint( avatarHeadPosition );
542+avatarHeadDirectionEndPoint += avatarHeadDirection;
543+
544+glDisable(GL_LIGHTING);
545+glLineWidth( 3.0 );
546+
547+// line from avatar head to origin
548+glBegin( GL_LINE_STRIP );
549+glColor4f( 1.0, 0.0, 0.0, 1.0 );
550+glVertex3f( avatarBodyPosition.x, avatarBodyPosition.y, avatarBodyPosition.z );
551+glVertex3f( 0.0f, 0.0f, 0.0f );
552+glEnd();
531553
554+//line from avatar head to 1 meter in front of avatar head
555+glBegin( GL_LINE_STRIP );
556+glColor3f( 0.0f, 1.0f, 1.0f );
557+glVertex3f( avatarHeadPosition.x, avatarHeadPosition.y, avatarHeadPosition.z );
558+glVertex3f( avatarHeadDirectionEndPoint.x, avatarHeadDirectionEndPoint.y, avatarHeadDirectionEndPoint.z );
559+glEnd();
560+
561+
562+ /*
532563 glm::vec3 cameraPosition = ::myHead.getPos()*-1.0; // We need to flip the sign to make this work.
533564 glm::vec3 cameraDirection = ::myHead.getAvatarHeadLookatDirection()*-1.0; // gak! Not sure if this is correct!
534565
@@ -550,7 +581,9 @@ void render_view_frustum() { · 15 unmodified lines
550581 glColor3f(0,1,1);
551582 glVertex3f(cameraPosition.x,cameraPosition.y,cameraPosition.z);
552583 glVertex3f(lookingAt.x,lookingAt.y,lookingAt.z);
553−
584+ */
585+
586+
554587 /*
555588 // Not yet ready for this...
556589 glm::vec3 up = glm::vec3(0.0,1.0,0.0);
@@ -727,7 +760,7 @@ void display(void) · 170 unmodified lines
727760 //---------------------------------------------
728761 // draw a grid gound plane....
729762 //---------------------------------------------
730− //drawGroundPlaneGrid( 5.0f, 9 );
763+ drawGroundPlaneGrid( 5.0f, 9 );
731764
732765
733766 // Draw cloud of dots

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t