From 2b4944203975b5e3495a7955e50c6c9dc7a7c07e Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 15 Apr 2013 18:34:40 -0700 Subject: [PATCH] resolve conflicts on merge with upstream master --- interface/src/Camera.cpp | 0 interface/src/Camera.h | 0 interface/src/Head.cpp | 83 ++++++++++++++++++++++++++++++++-------- interface/src/Head.h | 10 +++-- 4 files changed, 74 insertions(+), 19 deletions(-) mode change 100755 => 100644 interface/src/Camera.cpp mode change 100755 => 100644 interface/src/Camera.h diff --git a/interface/src/Camera.cpp b/interface/src/Camera.cpp old mode 100755 new mode 100644 diff --git a/interface/src/Camera.h b/interface/src/Camera.h old mode 100755 new mode 100644 diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 7af3347a7c..898d213781 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -122,8 +122,6 @@ Head::Head() { Head::Head(const Head &otherHead) { initializeAvatar(); - //velocity = otherHead.velocity; - //thrust = otherHead.thrust; for (int i = 0; i < MAX_DRIVE_KEYS; i++) driveKeys[i] = otherHead.driveKeys[i]; PupilSize = otherHead.PupilSize; @@ -362,8 +360,26 @@ void Head::simulate(float deltaTime) { bodyYawDelta += YAW_MAG * deltaTime; } + //---------------------------------------------------------- + float translationalSpeed = glm::length( avatar.velocity ); + float rotationalSpeed = fabs( bodyYawDelta ); + if ( translationalSpeed + rotationalSpeed > 0.2 ) + { + mode = AVATAR_MODE_WALKING; + } + else + { + mode = AVATAR_MODE_COMMUNICATING; + } + + //---------------------------------------------------------- + // update body yaw by body yaw delta + //---------------------------------------------------------- _bodyYaw += bodyYawDelta * deltaTime; + //---------------------------------------------------------- + // (for now) set head yaw to body yaw + //---------------------------------------------------------- Yaw = _bodyYaw; //---------------------------------------------------------- @@ -377,11 +393,10 @@ void Head::simulate(float deltaTime) { //---------------------------------------------------------- avatar.velocity += glm::dvec3( avatar.thrust * deltaTime ); + //---------------------------------------------------------- + // update position by velocity + //---------------------------------------------------------- _bodyPosition += (glm::vec3)avatar.velocity * deltaTime; - //avatar.position += (glm::vec3)avatar.velocity * deltaTime; - //position = avatar.position; - - //avatar.velocity *= 0.9; //---------------------------------------------------------- // decay velocity @@ -600,12 +615,7 @@ void Head::renderHead( int faceToFace, int isMine ) { glScalef( 0.03, 0.03, 0.03 ); - - //glTranslatef(leanSideways, 0.f, leanForward); - - //glRotatef(Yaw, 0, 1, 0); - - glRotatef( _bodyYaw, 0, 1, 0); + glRotatef(_bodyYaw, 0, 1, 0); // Don't render a head if it is really close to your location, because that is your own head! @@ -892,9 +902,14 @@ void Head::updateAvatarSkeleton() { // calculate positions of all bones by traversing the skeleton tree: //------------------------------------------------------------------------ for (int b=0; bgetPos().x, hand->getPos().y, hand->getPos().z); //previous to Ventrella change + bone[ AVATAR_BONE_RIGHT_HAND ].position.x, + bone[ AVATAR_BONE_RIGHT_HAND ].position.y, + bone[ AVATAR_BONE_RIGHT_HAND ].position.z ); + return strlen(data); +} + + +//called on the other agents - assigns it to my views of the others +void Head::parseData(void *data, int size) { + sscanf + ( + (char *)data, "H%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f", + &Pitch, &Yaw, &Roll, + //&avatar.yaw, &avatar.pitch, &avatar.roll, + &bodyPosition.x, &bodyPosition.y, &bodyPosition.z, + &loudness, &averageLoudness, + &bone[ AVATAR_BONE_RIGHT_HAND ].position.x, + &bone[ AVATAR_BONE_RIGHT_HAND ].position.y, + &bone[ AVATAR_BONE_RIGHT_HAND ].position.z + ); + + handBeingMoved = true; +} + void Head::SetNewHeadTarget(float pitch, float yaw) { PitchTarget = pitch; YawTarget = yaw; diff --git a/interface/src/Head.h b/interface/src/Head.h index d11c08128e..5b3c7eeeff 100644 --- a/interface/src/Head.h +++ b/interface/src/Head.h @@ -42,8 +42,6 @@ enum AvatarMode NUM_AVATAR_MODES }; - - enum AvatarBones { AVATAR_BONE_NULL = -1, @@ -131,7 +129,11 @@ class Head : public AvatarData { glm::vec3 getHeadLookatDirectionUp(); glm::vec3 getHeadLookatDirectionRight(); glm::vec3 getHeadPosition(); - glm::vec3 getBonePosition( AvatarBones b ); + glm::vec3 getBonePosition( AvatarBones b ); + + AvatarMode getMode(); + + void setTriggeringAction( bool trigger ); void render(int faceToFace, int isMine); @@ -202,6 +204,8 @@ class Head : public AvatarData { float audioAttack; float browAudioLift; + bool triggeringAction; + float bodyYawDelta; float closeEnoughToInteract;