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
511 }511 }
512}512}
513 513
514
515
516
514// XXXBHG - this code is not yet working. This is here to help Jeffery debug getAvatarHeadLookatDirection()517// XXXBHG - this code is not yet working. This is here to help Jeffery debug getAvatarHeadLookatDirection()
515// The code will draw a yellow line from the avatar's position to the origin,518// The code will draw a yellow line from the avatar's position to the origin,
516// It also attempts to draw a cyan line from the avatar to 2 meters in front of the avatar in the direction519// 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
528 // farDist – the distance from the camera to the far plane531 // farDist – the distance from the camera to the far plane
529 // farHeight – the height of the far plane532 // farHeight – the height of the far plane
530 // farWidth – the width of the far plane533 // farWidth – the width of the far plane
534
535
536//Jeffrey's variation:
537glm::vec3 avatarBodyPosition = myHead.getAvatarPosition();
538glm::vec3 avatarHeadPosition = myHead.getAvatarHeadPosition();
539glm::vec3 avatarHeadDirection = myHead.getAvatarHeadLookatDirection();
540
541glm::vec3 avatarHeadDirectionEndPoint( avatarHeadPosition );
542avatarHeadDirectionEndPoint += avatarHeadDirection;
543
544glDisable(GL_LIGHTING);
545glLineWidth( 3.0 );
546
547// line from avatar head to origin
548glBegin( GL_LINE_STRIP );
549glColor4f( 1.0, 0.0, 0.0, 1.0 );
550glVertex3f( avatarBodyPosition.x, avatarBodyPosition.y, avatarBodyPosition.z );
551glVertex3f( 0.0f, 0.0f, 0.0f );
552glEnd();
531 553
554//line from avatar head to 1 meter in front of avatar head
555glBegin( GL_LINE_STRIP );
556glColor3f( 0.0f, 1.0f, 1.0f );
557glVertex3f( avatarHeadPosition.x, avatarHeadPosition.y, avatarHeadPosition.z );
558glVertex3f( avatarHeadDirectionEndPoint.x, avatarHeadDirectionEndPoint.y, avatarHeadDirectionEndPoint.z );
559glEnd();
560
561
562 /*
532 glm::vec3 cameraPosition = ::myHead.getPos()*-1.0; // We need to flip the sign to make this work.563 glm::vec3 cameraPosition = ::myHead.getPos()*-1.0; // We need to flip the sign to make this work.
533 glm::vec3 cameraDirection = ::myHead.getAvatarHeadLookatDirection()*-1.0; // gak! Not sure if this is correct!564 glm::vec3 cameraDirection = ::myHead.getAvatarHeadLookatDirection()*-1.0; // gak! Not sure if this is correct!
534 565
@@ -550,7 +581,9 @@ void render_view_frustum() { · 15 unmodified lines
550 glColor3f(0,1,1);581 glColor3f(0,1,1);
551 glVertex3f(cameraPosition.x,cameraPosition.y,cameraPosition.z);582 glVertex3f(cameraPosition.x,cameraPosition.y,cameraPosition.z);
552 glVertex3f(lookingAt.x,lookingAt.y,lookingAt.z);583 glVertex3f(lookingAt.x,lookingAt.y,lookingAt.z);
553 584 */
585
586
554 /*587 /*
555 // Not yet ready for this...588 // Not yet ready for this...
556 glm::vec3 up = glm::vec3(0.0,1.0,0.0);589 glm::vec3 up = glm::vec3(0.0,1.0,0.0);
@@ -727,7 +760,7 @@ void display(void) · 170 unmodified lines
727 //---------------------------------------------760 //---------------------------------------------
728 // draw a grid gound plane....761 // draw a grid gound plane....
729 //---------------------------------------------762 //---------------------------------------------
730 //drawGroundPlaneGrid( 5.0f, 9 );763 drawGroundPlaneGrid( 5.0f, 9 );
731 764
732 765
733 // Draw cloud of dots766 // 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