From ca0582301097eaba8d73f470cbd3a6ae6616e302 Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Fri, 12 Apr 2013 18:06:11 -0700 Subject: [PATCH 1/6] added some smoothness to the camera --- interface/src/Camera.cpp | 23 ++++++++++++++++++----- interface/src/Camera.h | 10 +++++++--- interface/src/Head.cpp | 12 ++++-------- interface/src/Head.h | 2 -- interface/src/main.cpp | 35 ++++++++++++++++++----------------- 5 files changed, 47 insertions(+), 35 deletions(-) diff --git a/interface/src/Camera.cpp b/interface/src/Camera.cpp index 5a6899467c..e9d8a26675 100755 --- a/interface/src/Camera.cpp +++ b/interface/src/Camera.cpp @@ -8,10 +8,13 @@ #include "Camera.h" #include "Util.h" + + //------------------------ Camera::Camera() { mode = CAMERA_MODE_THIRD_PERSON; + tightness = DEFAULT_CAMERA_TIGHTNESS; fieldOfView = 60.0; // default yaw = 0.0; pitch = 0.0; @@ -20,13 +23,15 @@ Camera::Camera() distance = 0.0; targetPosition = glm::vec3( 0.0, 0.0, 0.0 ); position = glm::vec3( 0.0, 0.0, 0.0 ); + idealPosition = glm::vec3( 0.0, 0.0, 0.0 ); orientation.setToIdentity(); } -//------------------------ -void Camera::update() + +//------------------------------------ +void Camera::update( float deltaTime ) { double radian = ( yaw / 180.0 ) * PIE; @@ -35,11 +40,19 @@ void Camera::update() double z = distance * cos( radian ); double y = up; - position = targetPosition + glm::vec3( x, y, z ); + idealPosition = targetPosition + glm::vec3( x, y, z ); - //------------------------------------------------------------------------ + float t = tightness * deltaTime; + + if ( t > 1.0 ){ + t = 1.0; + } + + position += ( idealPosition - position ) * t; + + //------------------------------------------------------------------------- //geterate the ortho-normals for the orientation based on the Euler angles - //------------------------------------------------------------------------ + //------------------------------------------------------------------------- orientation.setToIdentity(); orientation.yaw ( yaw ); orientation.pitch ( pitch ); diff --git a/interface/src/Camera.h b/interface/src/Camera.h index 1c8c3335b5..fd347d00f7 100755 --- a/interface/src/Camera.h +++ b/interface/src/Camera.h @@ -20,13 +20,14 @@ enum CameraMode NUM_CAMERA_MODES }; +static const float DEFAULT_CAMERA_TIGHTNESS = 10.0f; class Camera { public: Camera(); - void update(); + void update( float deltaTime ); void setMode ( CameraMode m ) { mode = m; } void setYaw ( float y ) { yaw = y; } @@ -34,8 +35,9 @@ public: void setRoll ( float r ) { roll = r; } void setUp ( float u ) { up = u; } void setDistance ( float d ) { distance = d; } - void setTargetPosition ( glm::vec3 t ) { targetPosition = t; }; - void setPosition ( glm::vec3 p ) { position = p; }; + void setTargetPosition ( glm::vec3 t ) { targetPosition = t; } + void setPosition ( glm::vec3 p ) { position = p; } + void setTightness ( float t ) { tightness = t; } void setOrientation ( Orientation o ) { orientation.set(o); } float getYaw () { return yaw; } @@ -49,6 +51,7 @@ private: CameraMode mode; glm::vec3 position; + glm::vec3 idealPosition; glm::vec3 targetPosition; float fieldOfView; float yaw; @@ -56,6 +59,7 @@ private: float roll; float up; float distance; + float tightness; Orientation orientation; }; diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 37185d6442..41eac4bb8d 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -3,7 +3,7 @@ // interface // // Created by Philip Rosedale on 9/11/12. -// adapted by Jeffrey Ventrella, starting on April 2, 2013 +// adapted by Jeffrey Ventrella // Copyright (c) 2012 Physical, Inc.. All rights reserved. // @@ -47,10 +47,6 @@ unsigned int iris_texture_height = 256; Head::Head() { initializeAvatar(); - - //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; @@ -573,9 +569,9 @@ void Head::render(int faceToFace, int isMine) { void Head::renderOrientationDirections( glm::vec3 position, Orientation orientation, float size ) { - glm::vec3 pRight = position + orientation.right * size; - glm::vec3 pUp = position + orientation.getUp () * size; - glm::vec3 pFront = position + orientation.getFront () * size; + glm::vec3 pRight = position + orientation.right * size; + glm::vec3 pUp = position + orientation.up * size; + glm::vec3 pFront = position + orientation.front * size; glColor3f( 1.0f, 0.0f, 0.0f ); glBegin( GL_LINE_STRIP ); diff --git a/interface/src/Head.h b/interface/src/Head.h index eeaa4ebee0..51b95ecaed 100644 --- a/interface/src/Head.h +++ b/interface/src/Head.h @@ -250,13 +250,11 @@ class Head : public AgentData { bool handBeingMoved; bool previousHandBeingMoved; glm::vec3 movedHandOffset; - //glm::vec3 movedHandPosition; int driveKeys[MAX_DRIVE_KEYS]; float springVelocityDecay; float springForce; - //float springToBodyTightness; int eyeContact; eyeContactTargets eyeContactTarget; diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 6ded99e27f..93c5b8997c 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -729,29 +729,30 @@ void display(void) //-------------------------------------------------------- // camera settings //-------------------------------------------------------- - myCamera.setTargetPosition( myAvatar.getPos() ); - if ( displayHead ) { //----------------------------------------------- // set the camera to looking at my own face - //----------------------------------------------- - myCamera.setYaw ( - myAvatar.getBodyYaw() ); - myCamera.setPitch ( 0.0 ); - myCamera.setRoll ( 0.0 ); - myCamera.setUp ( 0.4 ); - myCamera.setDistance( 0.03 ); - myCamera.update(); + //----------------------------------------------- + myCamera.setTargetPosition ( myAvatar.getPos() ); + myCamera.setYaw ( - myAvatar.getBodyYaw() ); + myCamera.setPitch ( 0.0 ); + myCamera.setRoll ( 0.0 ); + myCamera.setUp ( 0.4 ); + myCamera.setDistance ( 0.03 ); + myCamera.setTightness ( 100.0f ); + myCamera.update ( 1.f/FPS ); } 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(); + myCamera.setTargetPosition ( myAvatar.getPos() ); + myCamera.setYaw ( 180.0 - myAvatar.getBodyYaw() ); + myCamera.setPitch ( 0.0 ); + myCamera.setRoll ( 0.0 ); + myCamera.setUp ( 0.2 ); + myCamera.setDistance ( 0.5 ); + myCamera.setTightness ( 10.0f ); + myCamera.update ( 1.f/FPS ); } // 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 @@ -773,7 +774,7 @@ void display(void) viewFrustumOffsetCamera.setRoll ( 0.0 + ::viewFrustumOffsetRoll ); viewFrustumOffsetCamera.setUp ( 0.2 + 0.2 ); viewFrustumOffsetCamera.setDistance( 0.5 + 0.2 ); - viewFrustumOffsetCamera.update(); + viewFrustumOffsetCamera.update( 1.f/FPS ); whichCamera = viewFrustumOffsetCamera; } From e97383be2eb3a97141548ec3b3ff78cc58738633 Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Mon, 15 Apr 2013 14:58:32 -0700 Subject: [PATCH 2/6] updated many aspects of the avatar hand motion as determined by mouse motion and mouse click --- interface/src/Head.cpp | 381 ++++++++++++++++++++++++----------------- interface/src/Head.h | 33 +++- interface/src/Util.h | 14 +- interface/src/main.cpp | 50 ++++-- 4 files changed, 288 insertions(+), 190 deletions(-) diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 7674f36382..452ebc50e9 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -91,7 +91,6 @@ Head::Head() { usingSprings = false; springForce = 6.0f; - springToBodyTightness = 4.0f; springVelocityDecay = 16.0f; if (iris_texture.size() == 0) { @@ -124,9 +123,8 @@ Head::Head() { Head::Head(const Head &otherHead) { initializeAvatar(); - position = otherHead.position; - //velocity = otherHead.velocity; - //thrust = otherHead.thrust; + bodyPosition = otherHead.bodyPosition; + for (int i = 0; i < MAX_DRIVE_KEYS; i++) driveKeys[i] = otherHead.driveKeys[i]; PupilSize = otherHead.PupilSize; @@ -247,6 +245,11 @@ void Head::setLeanSideways(float dist){ leanSideways = dist; } +void Head::setTriggeringAction( bool d ) { + triggeringAction = d; +} + + void Head::simulate(float deltaTime) { @@ -289,7 +292,7 @@ void Head::simulate(float deltaTime) { //------------------------------------- // test other avs for proximity... //------------------------------------- - glm::vec3 v( avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position ); + glm::vec3 v( bone[ AVATAR_BONE_RIGHT_HAND ].position ); v -= DEBUG_otherAvatarListPosition[o]; float distance = glm::length( v ); @@ -335,14 +338,15 @@ void Head::simulate(float deltaTime) { previousHandBeingMoved = handBeingMoved; handBeingMoved = false; - - + //------------------------------------------------- + // this handles the avatar being driven around... + //------------------------------------------------- const float THRUST_MAG = 10.0; const float YAW_MAG = 300.0; avatar.thrust = glm::vec3( 0.0, 0.0, 0.0 ); - //notice that the z values from avatar.orientation are flipped to accommodate different coordinate system + //notice that the z values from 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 ); avatar.thrust += front * THRUST_MAG; @@ -374,40 +378,54 @@ void Head::simulate(float deltaTime) { bodyYawDelta += YAW_MAG * deltaTime; } + //---------------------------------------------------------- + // if the avatar is moving, it is in "walking mode", + // otherwise it is in "standing" mode + //---------------------------------------------------------- + float translationalSpeed = glm::length( avatar.velocity ); + float rotationalSpeed = fabs( bodyYawDelta ); + if ( translationalSpeed + rotationalSpeed > 0.2 ) + { + mode = AVATAR_MODE_WALKING; + } + else + { + mode = AVATAR_MODE_STANDING; + } + + //---------------------------------------------------------- + // update body yaw by body yaw delta + //---------------------------------------------------------- bodyYaw += bodyYawDelta * deltaTime; + //---------------------------------------------------------- + // (for now) set head yaw to body yaw + //---------------------------------------------------------- Yaw = bodyYaw; + //---------------------------------------------------------- + // decay body yaw delta + //---------------------------------------------------------- const float TEST_YAW_DECAY = 5.0; bodyYawDelta *= ( 1.0 - TEST_YAW_DECAY * deltaTime ); + //---------------------------------------------------------- + // add thrust to velocity + //---------------------------------------------------------- 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; + //---------------------------------------------------------- + // update position by velocity + //---------------------------------------------------------- + bodyPosition += (glm::vec3)avatar.velocity * deltaTime; + //---------------------------------------------------------- + // decay velocity + //---------------------------------------------------------- const float LIN_VEL_DECAY = 5.0; avatar.velocity *= ( 1.0 - LIN_VEL_DECAY * deltaTime ); - - /* - // Increment velocity as time - velocity += thrust * deltaTime; - - // Increment position as a function of velocity - position += velocity * deltaTime; - */ - - - /* - // Decay velocity - const float LIN_VEL_DECAY = 5.0; - velocity *= (1.0 - LIN_VEL_DECAY*deltaTime); - */ - + if (!noise) { // Decay back toward center @@ -514,7 +532,7 @@ void Head::render(int faceToFace, int isMine) { // show avatar position //--------------------------------------------------- glPushMatrix(); - glTranslatef( position.x, position.y, position.z ); + glTranslatef( bodyPosition.x, bodyPosition.y, bodyPosition.z ); glScalef( 0.03, 0.03, 0.03 ); glutSolidSphere( 1, 10, 10 ); glPopMatrix(); @@ -522,7 +540,7 @@ void Head::render(int faceToFace, int isMine) { //--------------------------------------------------- // show avatar orientation //--------------------------------------------------- - renderOrientationDirections(avatar.bone[ AVATAR_BONE_HEAD ].position, avatar.bone[ AVATAR_BONE_HEAD ].orientation, 0.2f ); + renderOrientationDirections(bone[ AVATAR_BONE_HEAD ].position, bone[ AVATAR_BONE_HEAD ].orientation, 0.2f ); //--------------------------------------------------- // render body @@ -548,7 +566,7 @@ void Head::render(int faceToFace, int isMine) { if ( usingSprings ) { if ( closestOtherAvatar != -1 ) { - glm::vec3 v1( avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position ); + glm::vec3 v1( bone[ AVATAR_BONE_RIGHT_HAND ].position ); glm::vec3 v2( DEBUG_otherAvatarListPosition[ closestOtherAvatar ] ); glLineWidth( 5.0 ); @@ -570,19 +588,19 @@ void Head::renderOrientationDirections( glm::vec3 position, Orientation orientat 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( bone[ AVATAR_BONE_HEAD ].position.x, bone[ AVATAR_BONE_HEAD ].position.y, 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( bone[ AVATAR_BONE_HEAD ].position.x, bone[ AVATAR_BONE_HEAD ].position.y, 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( bone[ AVATAR_BONE_HEAD ].position.x, bone[ AVATAR_BONE_HEAD ].position.y, bone[ AVATAR_BONE_HEAD ].position.z ); glVertex3f( pFront.x, pFront.y, pFront.z ); glEnd(); } @@ -601,17 +619,17 @@ void Head::renderHead( int faceToFace, int isMine ) { if ( usingSprings ) { glTranslatef ( - avatar.bone[ AVATAR_BONE_HEAD ].springyPosition.x, - avatar.bone[ AVATAR_BONE_HEAD ].springyPosition.y, - avatar.bone[ AVATAR_BONE_HEAD ].springyPosition.z + bone[ AVATAR_BONE_HEAD ].springyPosition.x, + bone[ AVATAR_BONE_HEAD ].springyPosition.y, + bone[ AVATAR_BONE_HEAD ].springyPosition.z ); } else { glTranslatef ( - avatar.bone[ AVATAR_BONE_HEAD ].position.x, - avatar.bone[ AVATAR_BONE_HEAD ].position.y, - avatar.bone[ AVATAR_BONE_HEAD ].position.z + bone[ AVATAR_BONE_HEAD ].position.x, + bone[ AVATAR_BONE_HEAD ].position.y, + bone[ AVATAR_BONE_HEAD ].position.z ); } @@ -770,9 +788,14 @@ void Head::setHandMovement( glm::vec3 movement ) { movedHandOffset = movement; } +AvatarMode Head::getMode() +{ + return mode; +} + + void Head::initializeAvatar() { - //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(); @@ -785,11 +808,16 @@ void Head::initializeAvatar() { bodyYawDelta = 0.0; + triggeringAction = false; + + mode = AVATAR_MODE_STANDING; + for (int b=0; b 0.0f ) { glm::vec3 springDirection = springVector / length; - float force = ( length - avatar.bone[b].length ) * springForce * deltaTime; + float force = ( length - bone[b].length ) * springForce * deltaTime; - avatar.bone[ b ].springyVelocity -= springDirection * force; - avatar.bone[ avatar.bone[b].parent ].springyVelocity += springDirection * force; + bone[ b ].springyVelocity -= springDirection * force; + bone[ bone[b].parent ].springyVelocity += springDirection * force; } - avatar.bone[b].springyVelocity += ( avatar.bone[b].position - avatar.bone[b].springyPosition ) * springToBodyTightness * deltaTime; + bone[b].springyVelocity += ( bone[b].position - bone[b].springyPosition ) * bone[b].springBodyTightness * deltaTime; float decay = 1.0 - springVelocityDecay * deltaTime; if ( decay > 0.0 ) { - avatar.bone[b].springyVelocity *= decay; + bone[b].springyVelocity *= decay; } else { - avatar.bone[b].springyVelocity = glm::vec3( 0.0f, 0.0f, 0.0f ); + bone[b].springyVelocity = glm::vec3( 0.0f, 0.0f, 0.0f ); } - avatar.bone[b].springyPosition += avatar.bone[b].springyVelocity; + bone[b].springyPosition += bone[b].springyVelocity; } } @@ -1002,9 +1039,9 @@ glm::vec3 Head::getHeadLookatDirectionRight() { glm::vec3 Head::getHeadPosition() { return glm::vec3 ( - avatar.bone[ AVATAR_BONE_HEAD ].position.x, - avatar.bone[ AVATAR_BONE_HEAD ].position.y, - avatar.bone[ AVATAR_BONE_HEAD ].position.z + bone[ AVATAR_BONE_HEAD ].position.x, + bone[ AVATAR_BONE_HEAD ].position.y, + bone[ AVATAR_BONE_HEAD ].position.z ); } @@ -1012,9 +1049,9 @@ glm::vec3 Head::getHeadPosition() { glm::vec3 Head::getBodyPosition() { return glm::vec3 ( - avatar.bone[ AVATAR_BONE_PELVIS_SPINE ].position.x, - avatar.bone[ AVATAR_BONE_PELVIS_SPINE ].position.y, - avatar.bone[ AVATAR_BONE_PELVIS_SPINE ].position.z + bone[ AVATAR_BONE_PELVIS_SPINE ].position.x, + bone[ AVATAR_BONE_PELVIS_SPINE ].position.y, + bone[ AVATAR_BONE_PELVIS_SPINE ].position.z ); } @@ -1026,22 +1063,32 @@ void Head::updateHandMovement() { = avatar.orientation.getRight() * -movedHandOffset.x + avatar.orientation.getUp() * -movedHandOffset.y + avatar.orientation.getFront() * -movedHandOffset.y * 0.4f; + + bone[ AVATAR_BONE_RIGHT_HAND ].position += transformedHandMovement; //if holding hands, add a pull to the hand... if ( usingSprings ) { - if ( closestOtherAvatar != -1 ) { - glm::vec3 handShakePull( DEBUG_otherAvatarListPosition[ closestOtherAvatar ]); - handShakePull -= avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position; - - handShakePull *= 0.3; - - transformedHandMovement += handShakePull; + if ( closestOtherAvatar != -1 ) { + if ( triggeringAction ) { + + /* + glm::vec3 handShakePull( DEBUG_otherAvatarListPosition[ closestOtherAvatar ]); + handShakePull -= bone[ AVATAR_BONE_RIGHT_HAND ].position; + + handShakePull *= 1.0; + + transformedHandMovement += handShakePull; + */ + bone[ AVATAR_BONE_RIGHT_HAND ].position = DEBUG_otherAvatarListPosition[ closestOtherAvatar ]; + } } } - avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position += transformedHandMovement; - glm::vec3 armVector = avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position; - armVector -= avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].position; + //------------------------------------------------------------------------------- + // determine the arm vector + //------------------------------------------------------------------------------- + glm::vec3 armVector = bone[ AVATAR_BONE_RIGHT_HAND ].position; + armVector -= bone[ AVATAR_BONE_RIGHT_SHOULDER ].position; //------------------------------------------------------------------------------- // test to see if right hand is being dragged beyond maximum arm length @@ -1055,34 +1102,33 @@ void Head::updateHandMovement() { //------------------------------------------------------------------------------- // reset right hand to be constrained to maximum arm length //------------------------------------------------------------------------------- - avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position = avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].position; + bone[ AVATAR_BONE_RIGHT_HAND ].position = bone[ AVATAR_BONE_RIGHT_SHOULDER ].position; glm::vec3 armNormal = armVector / distance; armVector = armNormal * avatar.maxArmLength; distance = avatar.maxArmLength; - glm::vec3 constrainedPosition = avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].position; + glm::vec3 constrainedPosition = bone[ AVATAR_BONE_RIGHT_SHOULDER ].position; constrainedPosition += armVector; - avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position = constrainedPosition; + bone[ AVATAR_BONE_RIGHT_HAND ].position = constrainedPosition; } //----------------------------------------------------------------------------- // set elbow position //----------------------------------------------------------------------------- - glm::vec3 newElbowPosition = avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].position; - newElbowPosition += armVector * (float)ONE_HALF; + glm::vec3 newElbowPosition = bone[ AVATAR_BONE_RIGHT_SHOULDER ].position; + newElbowPosition += armVector * ONE_HALF; glm::vec3 perpendicular = glm::cross( avatar.orientation.getFront(), armVector ); - // XXXBHG - Jeffery, you should clean this up. You can't multiple glm::vec3's by doubles, only floats - newElbowPosition += perpendicular * (float)(( 1.0f - ( avatar.maxArmLength / distance ) ) * ONE_HALF); - avatar.bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].position = newElbowPosition; + newElbowPosition += perpendicular * ( 1.0f - ( avatar.maxArmLength / distance ) ) * ONE_HALF; + bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].position = newElbowPosition; //----------------------------------------------------------------------------- // set wrist position //----------------------------------------------------------------------------- - glm::vec3 vv( avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position ); - vv -= avatar.bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].position; - glm::vec3 newWristPosition = avatar.bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].position; + glm::vec3 vv( bone[ AVATAR_BONE_RIGHT_HAND ].position ); + vv -= bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].position; + glm::vec3 newWristPosition = bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].position; newWristPosition += vv * 0.7f; - avatar.bone[ AVATAR_BONE_RIGHT_FOREARM ].position = newWristPosition; + bone[ AVATAR_BONE_RIGHT_FOREARM ].position = newWristPosition; } @@ -1096,14 +1142,14 @@ void Head::renderBody() if ( usingSprings ) { glColor3fv( lightBlue ); glPushMatrix(); - glTranslatef( avatar.bone[b].springyPosition.x, avatar.bone[b].springyPosition.y, avatar.bone[b].springyPosition.z ); + glTranslatef( bone[b].springyPosition.x, bone[b].springyPosition.y, bone[b].springyPosition.z ); glutSolidSphere( 0.02f, 10.0f, 5.0f ); glPopMatrix(); } else { glColor3fv( skinColor ); glPushMatrix(); - glTranslatef( avatar.bone[b].position.x, avatar.bone[b].position.y, avatar.bone[b].position.z ); + glTranslatef( bone[b].position.x, bone[b].position.y, bone[b].position.z ); glutSolidSphere( 0.02f, 10.0f, 5.0f ); glPopMatrix(); } @@ -1118,8 +1164,8 @@ void Head::renderBody() for (int b=1; bgetPos().x, hand->getPos().y, hand->getPos().z); //previous to Ventrella change - avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position.x, - avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position.y, - avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position.z ); + bone[ AVATAR_BONE_RIGHT_HAND ].position.x, + bone[ AVATAR_BONE_RIGHT_HAND ].position.y, + bone[ AVATAR_BONE_RIGHT_HAND ].position.z ); return strlen(data); } @@ -1162,11 +1223,11 @@ void Head::parseData(void *data, int size) { (char *)data, "H%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f", &Pitch, &Yaw, &Roll, //&avatar.yaw, &avatar.pitch, &avatar.roll, - &position.x, &position.y, &position.z, + &bodyPosition.x, &bodyPosition.y, &bodyPosition.z, &loudness, &averageLoudness, - &avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position.x, - &avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position.y, - &avatar.bone[ AVATAR_BONE_RIGHT_HAND ].position.z + &bone[ AVATAR_BONE_RIGHT_HAND ].position.x, + &bone[ AVATAR_BONE_RIGHT_HAND ].position.y, + &bone[ AVATAR_BONE_RIGHT_HAND ].position.z ); handBeingMoved = true; diff --git a/interface/src/Head.h b/interface/src/Head.h index 1680a5bdcf..0e374daa02 100644 --- a/interface/src/Head.h +++ b/interface/src/Head.h @@ -29,7 +29,18 @@ enum eyeContactTargets {LEFT_EYE, RIGHT_EYE, MOUTH}; #define ROT_RIGHT 7 #define MAX_DRIVE_KEYS 8 -#define NUM_OTHER_AVATARS 5 +#define NUM_OTHER_AVATARS 5 // temporary - for testing purposes! + + +enum AvatarMode +{ + AVATAR_MODE_STANDING = 0, + AVATAR_MODE_WALKING, + AVATAR_MODE_COMMUNICATING, + NUM_AVATAR_MODES +}; + + /* enum AvatarJoints @@ -108,7 +119,7 @@ struct AvatarBone glm::vec3 defaultPosePosition; // the parent relative position when the avatar is in the "T-pose" glm::vec3 springyPosition; // used for special effects (a 'flexible' variant of position) glm::dvec3 springyVelocity; // used for special effects ( the velocity of the springy position) - float springBodyTightness; // how tightly (0 to 1) the springy position tries to stay on the position + float springBodyTightness; // how tightly the springy position tries to stay on the position float yaw; // the yaw Euler angle of the bone rotation off the parent float pitch; // the pitch Euler angle of the bone rotation off the parent float roll; // the roll Euler angle of the bone rotation off the parent @@ -122,7 +133,6 @@ struct Avatar glm::vec3 thrust; float maxArmLength; Orientation orientation; - AvatarBone bone[ NUM_AVATAR_BONES ]; }; class Head : public AgentData { @@ -161,6 +171,11 @@ class Head : public AgentData { glm::vec3 getHeadPosition(); glm::vec3 getBonePosition( AvatarBones b ); glm::vec3 getBodyPosition(); + + + AvatarMode getMode(); + + void setTriggeringAction( bool trigger ); void render(int faceToFace, int isMine); @@ -183,8 +198,8 @@ class Head : public AgentData { void setLoudness(float l) {loudness = l;}; void SetNewHeadTarget(float, float); - glm::vec3 getPos() { return position; }; - void setPos(glm::vec3 newpos) { position = newpos; }; + glm::vec3 getPos() { return bodyPosition; }; + void setPos(glm::vec3 newpos) { bodyPosition = newpos; }; // Set what driving keys are being pressed to control thrust levels void setDriveKeys(int key, bool val) { driveKeys[key] = val; }; @@ -237,7 +252,9 @@ class Head : public AgentData { float audioAttack; float browAudioLift; - glm::vec3 position; + glm::vec3 bodyPosition; + + bool triggeringAction; float bodyYaw; float bodyPitch; @@ -266,6 +283,10 @@ class Head : public AgentData { GLUquadric *sphere; Avatar avatar; + AvatarBone bone[ NUM_AVATAR_BONES ]; + + AvatarMode mode; + void initializeAvatar(); void updateAvatarSkeleton(); void initializeAvatarSprings(); diff --git a/interface/src/Util.h b/interface/src/Util.h index 56bc16f5d1..4d74e077fa 100644 --- a/interface/src/Util.h +++ b/interface/src/Util.h @@ -17,9 +17,9 @@ #include -static const double ZERO = 0.0; -static const double ONE = 1.0; -static const double ONE_HALF = 0.5; +static const float ZERO = 0.0; +static const float ONE = 1.0; +static const float ONE_HALF = 0.5; static const double ONE_THIRD = 0.3333333; static const double PIE = 3.14159265359; static const double PI_TIMES_TWO = 3.14159265359 * 2.0; @@ -27,10 +27,10 @@ static const double PI_OVER_180 = 3.14159265359 / 180.0; static const double EPSILON = 0.00001; //smallish number - used as margin of error for some computations static const double SQUARE_ROOT_OF_2 = sqrt(2); static const double SQUARE_ROOT_OF_3 = sqrt(3); -static const double METER = 1.0; -static const double DECIMETER = 0.1; -static const double CENTIMETER = 0.01; -static const double MILLIIMETER = 0.001; +static const float METER = 1.0; +static const float DECIMETER = 0.1; +static const float CENTIMETER = 0.01; +static const float MILLIIMETER = 0.001; float azimuth_to(glm::vec3 head_pos, glm::vec3 source_pos); float angle_to(glm::vec3 head_pos, glm::vec3 source_pos, float render_yaw, float head_yaw); diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 369a52195c..59cfbbe7d2 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -164,8 +164,11 @@ int displayHeadMouse = 1; // Display sample mouse pointer controlled by int headMouseX, headMouseY; int mouseX, mouseY; // Where is the mouse -int mouseStartX, mouseStartY; // Mouse location at start of last down click -int mousePressed = 0; // true if mouse has been pressed (clear when finished) + +// Mouse location at start of last down click +int mouseStartX;// = WIDTH / 2; +int mouseStartY;// = HEIGHT / 2; +int mousePressed = 0; // true if mouse has been pressed (clear when finished) Menu menu; // main menu int menuOn = 1; // Whether to show onscreen menu @@ -1295,26 +1298,39 @@ void idle(void) if (diffclock(&lastTimeIdle, &check) > IDLE_SIMULATE_MSECS) { // If mouse is being dragged, update hand movement in the avatar - if ( mousePressed == 1 ) { - - float xOffset = ( mouseX - mouseStartX ) / ( WIDTH * ONE_HALF ); - float yOffset = ( mouseY - mouseStartY ) / ( HEIGHT * ONE_HALF ); - - float leftRight = xOffset; - float downUp = yOffset; - float backFront = 0.0; - - glm::vec3 handMovement( leftRight, downUp, backFront ); - myAvatar.setHandMovement( handMovement ); + //if ( mousePressed == 1 ) + + if ( myAvatar.getMode() == AVATAR_MODE_STANDING ) { + float leftRight = ( mouseX - mouseStartX ) / ( WIDTH * ONE_HALF ); + float downUp = ( mouseY - mouseStartY ) / ( HEIGHT * ONE_HALF ); + float backFront = 0.0; + glm::vec3 handMovement( leftRight, downUp, backFront ); + myAvatar.setHandMovement( handMovement ); } + else { + mouseStartX = mouseX; + mouseStartY = mouseY; + } + + //-------------------------------------------------------- + // when the mouse is being pressed, an 'action' is being + // triggered in the avatarthe action is context-based. + //-------------------------------------------------------- + if ( mousePressed == 1 ) + { + myAvatar.setTriggeringAction( true ); + } + else + { + myAvatar.setTriggeringAction( false ); + } // Simulation - simulateHead(1.f/FPS); + simulateHead( 1.f/FPS ); //test /* - // simulate the other agents for(std::vector::iterator agent = agentList.getAgents().begin(); agent != agentList.getAgents().end(); agent++) { if (agent->getLinkedData() != NULL) @@ -1373,8 +1389,8 @@ void mouseFunc( int button, int state, int x, int y ) mouseX = x; mouseY = y; mousePressed = 1; - mouseStartX = x; - mouseStartY = y; + //mouseStartX = x; + //mouseStartY = y; } } if( button == GLUT_LEFT_BUTTON && state == GLUT_UP ) { From 427253b8b06a3a585abaedc38b8538a01f44f568 Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Mon, 15 Apr 2013 15:05:30 -0700 Subject: [PATCH 3/6] cleaned up formatting in Head --- interface/src/Head.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 452ebc50e9..f8ff965afe 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -836,9 +836,9 @@ void Head::initializeAvatar() { //---------------------------------------------------------------------------- // left chest and arm //---------------------------------------------------------------------------- - bone[ AVATAR_BONE_LEFT_CHEST ].parent = AVATAR_BONE_MID_SPINE; + bone[ AVATAR_BONE_LEFT_CHEST ].parent = AVATAR_BONE_MID_SPINE; bone[ AVATAR_BONE_LEFT_SHOULDER ].parent = AVATAR_BONE_LEFT_CHEST; - bone[ AVATAR_BONE_LEFT_UPPER_ARM ].parent = AVATAR_BONE_LEFT_SHOULDER; + bone[ AVATAR_BONE_LEFT_UPPER_ARM ].parent = AVATAR_BONE_LEFT_SHOULDER; bone[ AVATAR_BONE_LEFT_FOREARM ].parent = AVATAR_BONE_LEFT_UPPER_ARM; bone[ AVATAR_BONE_LEFT_HAND ].parent = AVATAR_BONE_LEFT_FOREARM; @@ -846,16 +846,16 @@ void Head::initializeAvatar() { // right chest and arm //---------------------------------------------------------------------------- bone[ AVATAR_BONE_RIGHT_CHEST ].parent = AVATAR_BONE_MID_SPINE; - bone[ AVATAR_BONE_RIGHT_SHOULDER ].parent = AVATAR_BONE_RIGHT_CHEST; + bone[ AVATAR_BONE_RIGHT_SHOULDER ].parent = AVATAR_BONE_RIGHT_CHEST; bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].parent = AVATAR_BONE_RIGHT_SHOULDER; bone[ AVATAR_BONE_RIGHT_FOREARM ].parent = AVATAR_BONE_RIGHT_UPPER_ARM; - bone[ AVATAR_BONE_RIGHT_HAND ].parent = AVATAR_BONE_RIGHT_FOREARM; + bone[ AVATAR_BONE_RIGHT_HAND ].parent = AVATAR_BONE_RIGHT_FOREARM; //---------------------------------------------------------------------------- // left pelvis and leg //---------------------------------------------------------------------------- bone[ AVATAR_BONE_LEFT_PELVIS ].parent = AVATAR_BONE_PELVIS_SPINE; - bone[ AVATAR_BONE_LEFT_THIGH ].parent = AVATAR_BONE_LEFT_PELVIS; + bone[ AVATAR_BONE_LEFT_THIGH ].parent = AVATAR_BONE_LEFT_PELVIS; bone[ AVATAR_BONE_LEFT_SHIN ].parent = AVATAR_BONE_LEFT_THIGH; bone[ AVATAR_BONE_LEFT_FOOT ].parent = AVATAR_BONE_LEFT_SHIN; @@ -864,8 +864,8 @@ void Head::initializeAvatar() { //---------------------------------------------------------------------------- bone[ AVATAR_BONE_RIGHT_PELVIS ].parent = AVATAR_BONE_PELVIS_SPINE; bone[ AVATAR_BONE_RIGHT_THIGH ].parent = AVATAR_BONE_RIGHT_PELVIS; - bone[ AVATAR_BONE_RIGHT_SHIN ].parent = AVATAR_BONE_RIGHT_THIGH; - bone[ AVATAR_BONE_RIGHT_FOOT ].parent = AVATAR_BONE_RIGHT_SHIN; + bone[ AVATAR_BONE_RIGHT_SHIN ].parent = AVATAR_BONE_RIGHT_THIGH; + bone[ AVATAR_BONE_RIGHT_FOOT ].parent = AVATAR_BONE_RIGHT_SHIN; //---------------------------------------------------------- @@ -876,24 +876,24 @@ void Head::initializeAvatar() { bone[ AVATAR_BONE_CHEST_SPINE ].defaultPosePosition = glm::vec3( 0.0, 0.1, 0.0 ); bone[ AVATAR_BONE_NECK ].defaultPosePosition = glm::vec3( 0.0, 0.06, 0.0 ); bone[ AVATAR_BONE_HEAD ].defaultPosePosition = glm::vec3( 0.0, 0.06, 0.0 ); - bone[ AVATAR_BONE_LEFT_CHEST ].defaultPosePosition = glm::vec3( -0.06, 0.06, 0.0 ); + bone[ AVATAR_BONE_LEFT_CHEST ].defaultPosePosition = glm::vec3( -0.06, 0.06, 0.0 ); bone[ AVATAR_BONE_LEFT_SHOULDER ].defaultPosePosition = glm::vec3( -0.03, 0.0, 0.0 ); - bone[ AVATAR_BONE_LEFT_UPPER_ARM ].defaultPosePosition = glm::vec3( 0.0, -0.12, 0.0 ); + bone[ AVATAR_BONE_LEFT_UPPER_ARM ].defaultPosePosition = glm::vec3( 0.0, -0.12, 0.0 ); bone[ AVATAR_BONE_LEFT_FOREARM ].defaultPosePosition = glm::vec3( 0.0, -0.1, 0.0 ); bone[ AVATAR_BONE_LEFT_HAND ].defaultPosePosition = glm::vec3( 0.0, -0.05, 0.0 ); bone[ AVATAR_BONE_RIGHT_CHEST ].defaultPosePosition = glm::vec3( 0.06, 0.06, 0.0 ); - bone[ AVATAR_BONE_RIGHT_SHOULDER ].defaultPosePosition = glm::vec3( 0.03, 0.0, 0.0 ); + bone[ AVATAR_BONE_RIGHT_SHOULDER ].defaultPosePosition = glm::vec3( 0.03, 0.0, 0.0 ); bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].defaultPosePosition = glm::vec3( 0.0, -0.12, 0.0 ); bone[ AVATAR_BONE_RIGHT_FOREARM ].defaultPosePosition = glm::vec3( 0.0, -0.1, 0.0 ); - bone[ AVATAR_BONE_RIGHT_HAND ].defaultPosePosition = glm::vec3( 0.0, -0.05, 0.0 ); + bone[ AVATAR_BONE_RIGHT_HAND ].defaultPosePosition = glm::vec3( 0.0, -0.05, 0.0 ); bone[ AVATAR_BONE_LEFT_PELVIS ].defaultPosePosition = glm::vec3( -0.05, 0.0, 0.0 ); - bone[ AVATAR_BONE_LEFT_THIGH ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 ); + bone[ AVATAR_BONE_LEFT_THIGH ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 ); bone[ AVATAR_BONE_LEFT_SHIN ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 ); bone[ AVATAR_BONE_LEFT_FOOT ].defaultPosePosition = glm::vec3( 0.0, 0.0, 0.04 ); bone[ AVATAR_BONE_RIGHT_PELVIS ].defaultPosePosition = glm::vec3( 0.05, 0.0, 0.0 ); bone[ AVATAR_BONE_RIGHT_THIGH ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 ); - bone[ AVATAR_BONE_RIGHT_SHIN ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 ); - bone[ AVATAR_BONE_RIGHT_FOOT ].defaultPosePosition = glm::vec3( 0.0, 0.0, 0.04 ); + bone[ AVATAR_BONE_RIGHT_SHIN ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 ); + bone[ AVATAR_BONE_RIGHT_FOOT ].defaultPosePosition = glm::vec3( 0.0, 0.0, 0.04 ); //---------------------------------------------------------------------------- // calculate bone length From 99c248064290390148f734fd0e4dec5d2e4412a9 Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Mon, 15 Apr 2013 15:29:49 -0700 Subject: [PATCH 4/6] small tweaks to get ready for bigger tweaks in avatar bone logic --- interface/src/Head.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index f8ff965afe..0e21bb3340 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -256,7 +256,7 @@ void Head::simulate(float deltaTime) { //------------------------------------- // DEBUG - other avatars... //------------------------------------- - closeEnoughToInteract = 0.5f; + closeEnoughToInteract = 0.3f; closestOtherAvatar = -1; float closestDistance = 10000.0f; @@ -923,7 +923,7 @@ void Head::calculateBoneLengths() { void Head::updateAvatarSkeleton() { //---------------------------------- - // rotate... + // rotate body... //---------------------------------- avatar.orientation.setToIdentity(); avatar.orientation.yaw( bodyYaw ); From fc8c0498cfee4b9d1d7ac42c22f3a146163d0682 Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Mon, 15 Apr 2013 16:16:05 -0700 Subject: [PATCH 5/6] adjusted avatar height and camera up to compensate - improves navigation --- interface/src/Head.cpp | 34 ++++++++++++++++++++++++++-------- interface/src/main.cpp | 10 +++++----- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 0e21bb3340..826dbbe459 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -110,11 +110,11 @@ Head::Head() { //-------------------------------------------------- // test... just slam them into random positions... //-------------------------------------------------- - DEBUG_otherAvatarListPosition[ 0 ] = glm::vec3( 0.0, 0.1, 2.0 ); - DEBUG_otherAvatarListPosition[ 1 ] = glm::vec3( 4.0, 0.1, 2.0 ); - DEBUG_otherAvatarListPosition[ 2 ] = glm::vec3( 2.0, 0.1, 2.0 ); - DEBUG_otherAvatarListPosition[ 3 ] = glm::vec3( 1.0, 0.1, -4.0 ); - DEBUG_otherAvatarListPosition[ 4 ] = glm::vec3( -2.0, 0.1, -2.0 ); + DEBUG_otherAvatarListPosition[ 0 ] = glm::vec3( 0.0, 0.3, 2.0 ); + DEBUG_otherAvatarListPosition[ 1 ] = glm::vec3( 4.0, 0.3, 2.0 ); + DEBUG_otherAvatarListPosition[ 2 ] = glm::vec3( 2.0, 0.3, 2.0 ); + DEBUG_otherAvatarListPosition[ 3 ] = glm::vec3( 1.0, 0.3, -4.0 ); + DEBUG_otherAvatarListPosition[ 4 ] = glm::vec3( -2.0, 0.3, -2.0 ); } @@ -871,7 +871,7 @@ void Head::initializeAvatar() { //---------------------------------------------------------- // specify the default pose position //---------------------------------------------------------- - bone[ AVATAR_BONE_PELVIS_SPINE ].defaultPosePosition = glm::vec3( 0.0, 0.1, 0.0 ); + bone[ AVATAR_BONE_PELVIS_SPINE ].defaultPosePosition = glm::vec3( 0.0, 0.3, 0.0 ); bone[ AVATAR_BONE_MID_SPINE ].defaultPosePosition = glm::vec3( 0.0, 0.1, 0.0 ); bone[ AVATAR_BONE_CHEST_SPINE ].defaultPosePosition = glm::vec3( 0.0, 0.1, 0.0 ); bone[ AVATAR_BONE_NECK ].defaultPosePosition = glm::vec3( 0.0, 0.06, 0.0 ); @@ -1062,7 +1062,7 @@ void Head::updateHandMovement() { transformedHandMovement = avatar.orientation.getRight() * -movedHandOffset.x + avatar.orientation.getUp() * -movedHandOffset.y - + avatar.orientation.getFront() * -movedHandOffset.y * 0.4f; + + avatar.orientation.getFront() * -movedHandOffset.y * 1.0f; bone[ AVATAR_BONE_RIGHT_HAND ].position += transformedHandMovement; @@ -1084,12 +1084,15 @@ void Head::updateHandMovement() { } } + + //------------------------------------------------------------------------------- // determine the arm vector //------------------------------------------------------------------------------- glm::vec3 armVector = bone[ AVATAR_BONE_RIGHT_HAND ].position; armVector -= bone[ AVATAR_BONE_RIGHT_SHOULDER ].position; + //------------------------------------------------------------------------------- // test to see if right hand is being dragged beyond maximum arm length //------------------------------------------------------------------------------- @@ -1111,6 +1114,21 @@ void Head::updateHandMovement() { bone[ AVATAR_BONE_RIGHT_HAND ].position = constrainedPosition; } + /* + //------------------------------------------------------------------------------- + // keep arm from going through av body... + //------------------------------------------------------------------------------- + glm::vec3 adjustedArmVector = bone[ AVATAR_BONE_RIGHT_HAND ].position; + adjustedArmVector -= bone[ AVATAR_BONE_RIGHT_SHOULDER ].position; + + float rightComponent = glm::dot( adjustedArmVector, avatar.orientation.getRight() ); + + if ( rightComponent < 0.0 ) + { + bone[ AVATAR_BONE_RIGHT_HAND ].position -= avatar.orientation.getRight() * rightComponent; + } + */ + //----------------------------------------------------------------------------- // set elbow position //----------------------------------------------------------------------------- @@ -1159,7 +1177,7 @@ void Head::renderBody() // Render lines connecting the bone positions //----------------------------------------------------- if ( usingSprings ) { - glColor3f( 0.2f, 0.3f, 0.4f ); + glColor3f( 0.4f, 0.5f, 0.6f ); glLineWidth(3.0); for (int b=1; b Date: Mon, 15 Apr 2013 18:03:34 -0700 Subject: [PATCH 6/6] yargh --- interface/src/Head.cpp | 57 +++++++++++------------------------------- interface/src/Head.h | 1 - interface/src/main.cpp | 15 ++++++----- 3 files changed, 22 insertions(+), 51 deletions(-) diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 826dbbe459..5fcb5026f2 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -35,6 +35,8 @@ float browWidth = 0.8; float browThickness = 0.16; const float DECAY = 0.1; +const float THRUST_MAG = 10.0; +const float YAW_MAG = 300.0; char iris_texture_file[] = "resources/images/green_eye.png"; @@ -101,8 +103,7 @@ Head::Head() { } } - for (int o=0; orender(1); - - // Don't render a head if it is really close to your location, because that is your own head! + + // Don't render a head if it is really close to your location, because that is your own head! //if (!isMine || faceToFace) { @@ -788,13 +765,11 @@ void Head::setHandMovement( glm::vec3 movement ) { movedHandOffset = movement; } -AvatarMode Head::getMode() -{ +AvatarMode Head::getMode() { return mode; } - void Head::initializeAvatar() { avatar.velocity = glm::vec3( 0.0, 0.0, 0.0 ); avatar.thrust = glm::vec3( 0.0, 0.0, 0.0 ); @@ -907,7 +882,6 @@ void Head::initializeAvatar() { } - void Head::calculateBoneLengths() { for (int b=0; b