From f294cc87820c529f1ba289ff83d4845bab4f9ef8 Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Wed, 10 Apr 2013 21:12:15 -0700 Subject: [PATCH 1/4] working on avatar orientation issues --- interface/src/Camera.cpp | 13 ++- interface/src/Head.cpp | 169 ++++++++++++++++++++------------------- interface/src/Head.h | 7 +- interface/src/main.cpp | 14 +--- 4 files changed, 101 insertions(+), 102 deletions(-) diff --git a/interface/src/Camera.cpp b/interface/src/Camera.cpp index 4eb0101eda..c71e02ebc0 100755 --- a/interface/src/Camera.cpp +++ b/interface/src/Camera.cpp @@ -18,8 +18,8 @@ Camera::Camera() roll = 0.0; up = 0.0; distance = 0.0; - targetPosition = glm::dvec3( 0.0, 0.0, 0.0 ); - position = glm::dvec3( 0.0, 0.0, 0.0 ); + targetPosition = glm::vec3( 0.0, 0.0, 0.0 ); + position = glm::vec3( 0.0, 0.0, 0.0 ); orientation.setToIdentity(); } @@ -30,12 +30,11 @@ void Camera::update() { double radian = ( yaw / 180.0 ) * PIE; - double x = distance * sin( radian ); - double z = distance * -cos( radian ); - double y = -up; + double x = distance * -sin( radian ); + double z = distance * cos( radian ); + double y = up; - position = glm::dvec3( targetPosition ); - position += glm::dvec3( x, y, z ); + position = targetPosition + glm::vec3( x, y, z ); //------------------------------------------------------------------------ //geterate the ortho-normals for the orientation based on the Euler angles diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 3e9597faa5..98df7cc25e 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -47,8 +47,8 @@ Head::Head() { initializeAvatar(); - position = glm::vec3(0,0,0); - velocity = glm::vec3(0,0,0); + //position = glm::vec3(0,0,0); + //velocity = glm::vec3(0,0,0); thrust = glm::vec3(0,0,0); for (int i = 0; i < MAX_DRIVE_KEYS; i++) driveKeys[i] = false; @@ -91,8 +91,8 @@ Head::Head() sphere = NULL; springForce = 6.0f; - springToBodyTightness = 2.0f; - springVelocityDecay = 5.0f; + springToBodyTightness = 4.0f; + springVelocityDecay = 1.0f; hand = new Hand(glm::vec3(skinColor[0], skinColor[1], skinColor[2])); @@ -114,7 +114,7 @@ Head::Head(const Head &otherHead) initializeAvatar(); position = otherHead.position; - velocity = otherHead.velocity; + //velocity = otherHead.velocity; thrust = otherHead.thrust; for (int i = 0; i < MAX_DRIVE_KEYS; i++) driveKeys[i] = otherHead.driveKeys[i]; @@ -242,15 +242,6 @@ void Head::UpdatePos(float frametime, SerialInterface * serialInterface, int hea } - - -//--------------------------------------------------- -void Head::setAvatarPosition( float x, float y, float z ) -{ - avatar.position = glm::vec3( x, y, z ); -} - - //--------------------------------------------------- void Head::addLean(float x, float z) { // Add Body lean as impulse @@ -288,23 +279,7 @@ void Head::simulate(float deltaTime) // update springy behavior: //------------------------------------------------------------------------ updateAvatarSprings( deltaTime ); - - - /* - glm::vec3 forward - ( - -sin( avatar.yaw * PI_OVER_180 ), - sin( avatar.pitch * PI_OVER_180 ), - cos( avatar.roll * PI_OVER_180 ) - ); - - glm::vec3 forward(-sinf(getRenderYaw()*PI/180), - sinf(getRenderPitch()*PI/180), - cosf(getRenderYaw()*PI/180)); - - thrust = glm::vec3(0); - */ - + const float THRUST_MAG = 10.0; const float YAW_MAG = 300.0; @@ -313,32 +288,32 @@ void Head::simulate(float deltaTime) //notice that the z values from avatar.orientation are flipped to accommodate different coordinate system if (driveKeys[FWD]) { - glm::vec3 front( avatar.orientation.getFront().x, avatar.orientation.getFront().y, -avatar.orientation.getFront().z ); + glm::vec3 front( avatar.orientation.getFront().x, avatar.orientation.getFront().y, avatar.orientation.getFront().z ); avatar.thrust += front * THRUST_MAG; } if (driveKeys[BACK]) { - glm::vec3 front( avatar.orientation.getFront().x, avatar.orientation.getFront().y, -avatar.orientation.getFront().z ); + glm::vec3 front( avatar.orientation.getFront().x, avatar.orientation.getFront().y, avatar.orientation.getFront().z ); avatar.thrust -= front * THRUST_MAG; } if (driveKeys[RIGHT]) { - glm::vec3 right( avatar.orientation.getRight().x, avatar.orientation.getRight().y, -avatar.orientation.getRight().z ); + glm::vec3 right( avatar.orientation.getRight().x, avatar.orientation.getRight().y, avatar.orientation.getRight().z ); avatar.thrust += right * THRUST_MAG; } if (driveKeys[LEFT]) { - glm::vec3 right( avatar.orientation.getRight().x, avatar.orientation.getRight().y, -avatar.orientation.getRight().z ); + glm::vec3 right( avatar.orientation.getRight().x, avatar.orientation.getRight().y, avatar.orientation.getRight().z ); avatar.thrust -= right * THRUST_MAG; } if (driveKeys[UP]) { - glm::vec3 up( avatar.orientation.getUp().x, avatar.orientation.getUp().y, -avatar.orientation.getUp().z ); + glm::vec3 up( avatar.orientation.getUp().x, avatar.orientation.getUp().y, avatar.orientation.getUp().z ); avatar.thrust += up * THRUST_MAG; } if (driveKeys[DOWN]) { - glm::vec3 up( avatar.orientation.getUp().x, avatar.orientation.getUp().y, -avatar.orientation.getUp().z ); + glm::vec3 up( avatar.orientation.getUp().x, avatar.orientation.getUp().y, avatar.orientation.getUp().z ); avatar.thrust -= up * THRUST_MAG; } @@ -358,11 +333,11 @@ void Head::simulate(float deltaTime) const float TEST_YAW_DECAY = 5.0; avatar.yawDelta *= ( 1.0 - TEST_YAW_DECAY * deltaTime ); - //avatar.yawDelta *= 0.99; - avatar.velocity += glm::dvec3( avatar.thrust * deltaTime ); position += (glm::vec3)avatar.velocity * deltaTime; + //avatar.position += (glm::vec3)avatar.velocity * deltaTime; + //position = avatar.position; //avatar.velocity *= 0.9; @@ -492,11 +467,46 @@ void Head::simulate(float deltaTime) //--------------------------------------------------- void Head::render(int faceToFace, int isMine) { + glPushMatrix(); + glTranslatef( position.x, position.y, position.z ); + glScalef( 0.03, 0.03, 0.03 ); + glutSolidSphere( 1, 10, 10 ); + glPopMatrix(); + + renderOrientationDirections(avatar.bone[ AVATAR_BONE_HEAD ].position, avatar.bone[ AVATAR_BONE_HEAD ].orientation, 0.2f ); + renderBody(); renderHead( faceToFace, isMine ); } + +//--------------------------------------------------- +void Head::renderOrientationDirections( glm::vec3 position, Orientation orientation, float size ) +{ + glm::vec3 pRight = position + orientation.getRight () * size; + glm::vec3 pUp = position + orientation.getUp () * size; + glm::vec3 pFront = position + orientation.getFront () * size; + + glColor3f( 1.0f, 0.0f, 0.0f ); + glBegin( GL_LINE_STRIP ); + glVertex3f( avatar.bone[ AVATAR_BONE_HEAD ].position.x, avatar.bone[ AVATAR_BONE_HEAD ].position.y, avatar.bone[ AVATAR_BONE_HEAD ].position.z ); + glVertex3f( pRight.x, pRight.y, pRight.z ); + glEnd(); + + glColor3f( 0.0f, 1.0f, 0.0f ); + glBegin( GL_LINE_STRIP ); + glVertex3f( avatar.bone[ AVATAR_BONE_HEAD ].position.x, avatar.bone[ AVATAR_BONE_HEAD ].position.y, avatar.bone[ AVATAR_BONE_HEAD ].position.z ); + glVertex3f( pUp.x, pUp.y, pUp.z ); + glEnd(); + + glColor3f( 0.0f, 0.0f, 1.0f ); + glBegin( GL_LINE_STRIP ); + glVertex3f( avatar.bone[ AVATAR_BONE_HEAD ].position.x, avatar.bone[ AVATAR_BONE_HEAD ].position.y, avatar.bone[ AVATAR_BONE_HEAD ].position.z ); + glVertex3f( pFront.x, pFront.y, pFront.z ); + glEnd(); +} + //--------------------------------------------------- @@ -682,12 +692,12 @@ void Head::setHandMovement( glm::vec3 movement ) //----------------------------------------- void Head::initializeAvatar() { - avatar.position = glm::vec3( 0.0, 0.0, 0.0 ); + //avatar.position = glm::vec3( 0.0, 0.0, 0.0 ); avatar.velocity = glm::vec3( 0.0, 0.0, 0.0 ); avatar.thrust = glm::vec3( 0.0, 0.0, 0.0 ); avatar.orientation.setToIdentity(); - avatar.yaw = 90.0; + avatar.yaw = -90.0; avatar.pitch = 0.0; avatar.roll = 0.0; @@ -812,24 +822,26 @@ void Head::updateAvatarSkeleton() // rotate... //------------------------------------------------------------------------ avatar.orientation.setToIdentity(); - avatar.orientation.yaw( -avatar.yaw ); + avatar.orientation.yaw( avatar.yaw ); //------------------------------------------------------------------------ // calculate positions of all bones by traversing the skeleton tree: //------------------------------------------------------------------------ for (int b=0; b avatar.maxArmLength ) - { - avatar.bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].position += v * 0.2; - } - */ } @@ -894,11 +899,11 @@ void Head::updateAvatarSprings( float deltaTime ) if ( avatar.bone[b].parent == AVATAR_BONE_NULL ) { - springVector -= avatar.position; + springVector -= position; } else if ( avatar.bone[b].parent == AVATAR_BONE_PELVIS_SPINE ) { - springVector -= avatar.position; + springVector -= position; } else { @@ -964,7 +969,7 @@ glm::vec3 Head::getHeadLookatDirectionRight() ( avatar.orientation.getRight().x, avatar.orientation.getRight().y, - -avatar.orientation.getRight().z + avatar.orientation.getRight().z ); } @@ -1003,17 +1008,17 @@ void Head::updateHandMovement() transformedHandMovement.x = glm::dot( movedHandOffset.x, -(float)avatar.orientation.getRight().x ) + glm::dot( movedHandOffset.y, -(float)avatar.orientation.getRight().y ) - + glm::dot( movedHandOffset.z, (float)avatar.orientation.getRight().z ); + + glm::dot( movedHandOffset.z, -(float)avatar.orientation.getRight().z ); transformedHandMovement.y = glm::dot( movedHandOffset.x, -(float)avatar.orientation.getUp().x ) + glm::dot( movedHandOffset.y, -(float)avatar.orientation.getUp().y ) - + glm::dot( movedHandOffset.z, (float)avatar.orientation.getUp().z ); + + glm::dot( movedHandOffset.z, -(float)avatar.orientation.getUp().z ); transformedHandMovement.z = glm::dot( movedHandOffset.x, -(float)avatar.orientation.getFront().x ) + glm::dot( movedHandOffset.y, -(float)avatar.orientation.getFront().y ) - + glm::dot( movedHandOffset.z, (float)avatar.orientation.getFront().z ); + + glm::dot( movedHandOffset.z, -(float)avatar.orientation.getFront().z ); avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position += transformedHandMovement; glm::vec3 armVector = avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position; @@ -1093,7 +1098,7 @@ void Head::renderBody() for (int b=1; b Date: Wed, 10 Apr 2013 21:21:13 -0700 Subject: [PATCH 2/4] adding camera vs head for frustum view, not working yet --- interface/src/main.cpp | 125 +++++++++++++++++++++++++++++++---------- 1 file changed, 94 insertions(+), 31 deletions(-) diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 3953a657f1..1ff692c613 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -158,6 +158,7 @@ VoxelDetail paintingVoxel; // The voxel we're painting if we're painting unsigned char dominantColor = 0; // The dominant color of the voxel we're painting bool perfStatsOn = false; // Do we want to display perfStats? bool frustumOn = false; // Whether or not to display the debug view frustum +bool cameraFrustum = false; // which frustum to look at bool viewFrustumFromOffset=false; // Wether or not to offset the view of the frustum float viewFrustumOffsetYaw = -90.0; @@ -533,11 +534,48 @@ void render_view_frustum() { // farHeight – the height of the far plane // farWidth – the width of the far plane - glm::vec3 viewFrustumPosition = myAvatar.getHeadPosition(); - glm::vec3 viewFrustumDirection = myAvatar.getHeadLookatDirection(); + glm::vec3 cameraPosition = ::myCamera.getPosition() * -1.0; + glm::vec3 headPosition = ::myAvatar.getHeadPosition(); + printf("\nPosition:\n"); + printf("cameraPosition=%f, cameraPosition=%f, cameraPosition=%f\n",cameraPosition.x,cameraPosition.y,cameraPosition.z); + printf("headPosition.x=%f, headPosition.y=%f, headPosition.z=%f\n",headPosition.x,headPosition.y,headPosition.z); + + glm::vec3 cameraDirection = ::myCamera.getOrientation().getFront() * glm::vec3(-1,-1,-1); + glm::vec3 headDirection = myAvatar.getHeadLookatDirection(); + printf("\nDirection:\n"); + printf("cameraDirection.x=%f, cameraDirection.y=%f, cameraDirection.z=%f\n",cameraDirection.x,cameraDirection.y,cameraDirection.z); + printf("headDirection.x=%f, headDirection.y=%f, headDirection.z=%f\n",headDirection.x,headDirection.y,headDirection.z); + + glm::vec3 cameraUp = myCamera.getOrientation().getUp() * glm::vec3(1,1,-1); + glm::vec3 headUp = myAvatar.getHeadLookatDirectionUp(); + printf("\nUp:\n"); + printf("cameraUp.x=%f, cameraUp.y=%f, cameraUp.z=%f\n",cameraUp.x,cameraUp.y,cameraUp.z); + printf("headUp.x=%f, headUp.y=%f, headUp.z=%f\n",headUp.x,headUp.y,headUp.z); + + glm::vec3 cameraRight = myCamera.getOrientation().getRight() * glm::vec3(1,-1,1); + glm::vec3 headRight = myAvatar.getHeadLookatDirectionRight(); + printf("\nRight:\n"); + printf("cameraRight.x=%f, cameraRight.y=%f, cameraRight.z=%f\n",cameraRight.x,cameraRight.y,cameraRight.z); + printf("headRight.x=%f, headRight.y=%f, headRight.z=%f\n",headRight.x,headRight.y,headRight.z); + + glm::vec3 viewFrustumPosition; + glm::vec3 viewFrustumDirection; + glm::vec3 up; + glm::vec3 right; + + // Camera or Head? + if (::cameraFrustum) { + viewFrustumPosition = cameraPosition; + viewFrustumDirection = cameraDirection; + up = cameraUp; + right = cameraRight; + } else { + viewFrustumPosition = headPosition; + viewFrustumDirection = headDirection; + up = headUp; + right = headRight; + } - glm::vec3 up = myAvatar.getHeadLookatDirectionUp(); - glm::vec3 right = myAvatar.getHeadLookatDirectionRight(); // what? this are negative?? GRRRR!!! float nearDist = -0.1; @@ -569,9 +607,21 @@ void render_view_frustum() { // Get ready to draw some lines glDisable(GL_LIGHTING); glColor4f(1.0, 1.0, 1.0, 1.0); - glLineWidth(1.0); glBegin(GL_LINES); + glLineWidth(3.0); + glColor3f(1,1,1); + glm::vec3 headLookingAt = headPosition+(headDirection*-2.0); + glVertex3f(headPosition.x,headPosition.y,headPosition.z); + glVertex3f(headLookingAt.x,headLookingAt.y,headLookingAt.z); + + glColor3f(1,1,1); + glm::vec3 cameraLookingAt = cameraPosition+(cameraDirection*-2.0); + glVertex3f(cameraPosition.x,cameraPosition.y,cameraPosition.z); + glVertex3f(cameraLookingAt.x,cameraLookingAt.y,cameraLookingAt.z); + + // The remaining lines are skinny + glLineWidth(1.0); // near plane - bottom edge glColor3f(1,0,0); glVertex3f(nearBottomLeft.x,nearBottomLeft.y,nearBottomLeft.z); @@ -674,37 +724,49 @@ void display(void) myCamera.setDistance( 0.08 ); myCamera.update(); } else { - if (::viewFrustumFromOffset && ::frustumOn) { - //---------------------------------------------------- - // set the camera to third-person view but offset so we can see the frustum - //---------------------------------------------------- - myCamera.setYaw ( 180.0 - myAvatar.getBodyYaw() + ::viewFrustumOffsetYaw ); - myCamera.setPitch ( 0.0 + ::viewFrustumOffsetPitch ); - myCamera.setRoll ( 0.0 + ::viewFrustumOffsetRoll ); - myCamera.setUp ( 0.2 + 0.2 ); - myCamera.setDistance( 0.5 + 0.2 ); - myCamera.update(); - } else { - //---------------------------------------------------- - // set the camera to third-person view behind my av - //---------------------------------------------------- - myCamera.setYaw ( 180.0 - myAvatar.getBodyYaw() ); - myCamera.setPitch ( 0.0 ); - myCamera.setRoll ( 0.0 ); - myCamera.setUp ( 0.2 ); - myCamera.setDistance( 1.6 ); - myCamera.setDistance( 0.5 ); - myCamera.update(); - } + //---------------------------------------------------- + // set the camera to third-person view behind my av + //---------------------------------------------------- + myCamera.setYaw ( 180.0 - myAvatar.getBodyYaw() ); + myCamera.setPitch ( 0.0 ); + myCamera.setRoll ( 0.0 ); + myCamera.setUp ( 0.2 ); + myCamera.setDistance( 1.6 ); + myCamera.setDistance( 0.5 ); + myCamera.update(); } + // Note: whichCamera is used to pick between the normal camera myCamera for our + // main camera, vs, an alternate camera. The alternate camera we support right now + // is the viewFrustumOffsetCamera. But theoretically, we could use this same mechanism + // to add other cameras. + // + // Why have two cameras? Well, one reason is that because in the case of the render_view_frustum() + // code, we want to keep the state of "myCamera" intact, so we can render what the view frustum of + // myCamera is. But we also want to do meaningful camera transforms on OpenGL for the offset camera + Camera whichCamera = myCamera; + Camera viewFrustumOffsetCamera = myCamera; + + if (::viewFrustumFromOffset && ::frustumOn) { + //---------------------------------------------------- + // set the camera to third-person view but offset so we can see the frustum + //---------------------------------------------------- + viewFrustumOffsetCamera.setYaw ( 180.0 - myAvatar.getBodyYaw() + ::viewFrustumOffsetYaw ); + viewFrustumOffsetCamera.setPitch ( 0.0 + ::viewFrustumOffsetPitch ); + viewFrustumOffsetCamera.setRoll ( 0.0 + ::viewFrustumOffsetRoll ); + viewFrustumOffsetCamera.setUp ( 0.2 + 0.2 ); + viewFrustumOffsetCamera.setDistance( 0.5 + 0.2 ); + viewFrustumOffsetCamera.update(); + + whichCamera = viewFrustumOffsetCamera; + } //--------------------------------------------- // transform view according to myCamera //--------------------------------------------- - glRotatef ( myCamera.getPitch(), 1, 0, 0 ); - glRotatef ( myCamera.getYaw(), 0, 1, 0 ); - glRotatef ( myCamera.getRoll(), 0, 0, 1 ); - glTranslatef( myCamera.getPosition().x, myCamera.getPosition().y, myCamera.getPosition().z ); + glRotatef ( whichCamera.getPitch(), 1, 0, 0 ); + glRotatef ( whichCamera.getYaw(), 0, 1, 0 ); + glRotatef ( whichCamera.getRoll(), 0, 0, 1 ); + glTranslatef( whichCamera.getPosition().x, whichCamera.getPosition().y, whichCamera.getPosition().z ); if (::starsOn) { // should be the first rendering pass - w/o depth buffer / lighting @@ -1057,6 +1119,7 @@ void key(unsigned char k, int x, int y) if (k == '*') ::starsOn = !::starsOn; // toggle stars if (k == 'V') ::showingVoxels = !::showingVoxels; // toggle voxels if (k == 'F') ::frustumOn = !::frustumOn; // toggle view frustum debugging + if (k == 'C') ::cameraFrustum = !::cameraFrustum; // toggle which frustum to look at if (k == 'G') ::viewFrustumFromOffset = !::viewFrustumFromOffset; // toggle view frustum from offset debugging if (k == '[') ::viewFrustumOffsetYaw -= 0.5; From 712b14c364272d11e0d02a28dd77db1316e05600 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 10 Apr 2013 21:27:29 -0700 Subject: [PATCH 3/4] hacking on frustum for camera --- interface/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 1ff692c613..067363820a 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -540,7 +540,7 @@ void render_view_frustum() { printf("cameraPosition=%f, cameraPosition=%f, cameraPosition=%f\n",cameraPosition.x,cameraPosition.y,cameraPosition.z); printf("headPosition.x=%f, headPosition.y=%f, headPosition.z=%f\n",headPosition.x,headPosition.y,headPosition.z); - glm::vec3 cameraDirection = ::myCamera.getOrientation().getFront() * glm::vec3(-1,-1,-1); + glm::vec3 cameraDirection = ::myCamera.getOrientation().getFront() * glm::vec3(-1,-1,1); glm::vec3 headDirection = myAvatar.getHeadLookatDirection(); printf("\nDirection:\n"); printf("cameraDirection.x=%f, cameraDirection.y=%f, cameraDirection.z=%f\n",cameraDirection.x,cameraDirection.y,cameraDirection.z); From 6b4486c8c9d628c545a8da93bdab538c867aaf6f Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Wed, 10 Apr 2013 21:34:54 -0700 Subject: [PATCH 4/4] removed Vector3D class and fixed bug in avatar springs --- interface/src/Head.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 98df7cc25e..5b1b58646b 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -855,19 +855,9 @@ void Head::updateAvatarSkeleton() + glm::dot( avatar.bone[b].defaultPosePosition.z, (float)avatar.bone[b].orientation.getFront ().z ); */ - float xx = glm::dot( avatar.bone[b].defaultPosePosition.x, (float)avatar.bone[b].orientation.getRight ().x ) - + glm::dot( avatar.bone[b].defaultPosePosition.y, (float)avatar.bone[b].orientation.getRight ().y ) - + glm::dot( avatar.bone[b].defaultPosePosition.z, (float)avatar.bone[b].orientation.getRight ().z ); - - float yy = glm::dot( avatar.bone[b].defaultPosePosition.x, (float)avatar.bone[b].orientation.getUp ().x ) - + glm::dot( avatar.bone[b].defaultPosePosition.y, (float)avatar.bone[b].orientation.getUp ().y ) - + glm::dot( avatar.bone[b].defaultPosePosition.z, (float)avatar.bone[b].orientation.getUp ().z ); - - float zz = glm::dot( avatar.bone[b].defaultPosePosition.x, (float)avatar.bone[b].orientation.getFront ().x ) - + glm::dot( avatar.bone[b].defaultPosePosition.y, (float)avatar.bone[b].orientation.getFront ().y ) - + glm::dot( avatar.bone[b].defaultPosePosition.z, (float)avatar.bone[b].orientation.getFront ().z ); - - + float xx = glm::dot( avatar.bone[b].defaultPosePosition, avatar.bone[b].orientation.getRight () ); + float yy = glm::dot( avatar.bone[b].defaultPosePosition, avatar.bone[b].orientation.getUp () ); + float zz = -glm::dot( avatar.bone[b].defaultPosePosition, avatar.bone[b].orientation.getFront () ); //float xx = avatar.bone[b].defaultPosePosition.x; //float yy = avatar.bone[b].defaultPosePosition.y;