From 4e12f26467648e2b0e9a24db061629d790c5a6a9 Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Wed, 17 Apr 2013 18:10:32 -0700 Subject: [PATCH] added _isMine check for my _bodyYaw update --- interface/src/Head.cpp | 13 ++++++------- interface/src/main.cpp | 9 ++++----- libraries/avatars/src/AvatarData.cpp | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 0ee70d11cf..084d7a618d 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -388,6 +388,7 @@ void Head::simulate(float deltaTime) { } } + //---------------------------------------------------------- float translationalSpeed = glm::length( _avatar.velocity ); float rotationalSpeed = fabs( _bodyYawDelta ); @@ -403,8 +404,10 @@ void Head::simulate(float deltaTime) { //---------------------------------------------------------- // update body yaw by body yaw delta //---------------------------------------------------------- + if (_isMine) { _bodyYaw += _bodyYawDelta * deltaTime; - + } + //---------------------------------------------------------- // (for now) set head yaw to body yaw //---------------------------------------------------------- @@ -414,12 +417,12 @@ void Head::simulate(float deltaTime) { // decay body yaw delta //---------------------------------------------------------- const float TEST_YAW_DECAY = 5.0; - _bodyYawDelta *= ( 1.0 - TEST_YAW_DECAY * deltaTime ); + _bodyYawDelta *= (1.0 - TEST_YAW_DECAY * deltaTime); //---------------------------------------------------------- // add thrust to velocity //---------------------------------------------------------- - _avatar.velocity += glm::dvec3( _avatar.thrust * deltaTime ); + _avatar.velocity += glm::dvec3(_avatar.thrust * deltaTime); //---------------------------------------------------------- // update position by velocity @@ -432,8 +435,6 @@ void Head::simulate(float deltaTime) { const float LIN_VEL_DECAY = 5.0; _avatar.velocity *= ( 1.0 - LIN_VEL_DECAY * deltaTime ); - - if (!noise) { // Decay back toward center Pitch *= (1.f - DECAY*2*deltaTime); @@ -450,8 +451,6 @@ void Head::simulate(float deltaTime) { leanForward *= (1.f - DECAY*30.f*deltaTime); leanSideways *= (1.f - DECAY*30.f*deltaTime); - - // Update where the avatar's eyes are // // First, decide if we are making eye contact or not diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 62fa6c77a3..a0e4903bcd 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -1365,10 +1365,9 @@ void idle(void) { // updateAvatar( 1.f/FPS ); - - //test - /* - for(std::vector::iterator agent = agentList.getAgents().begin(); agent != agentList.getAgents().end(); agent++) + //loop through all the other avatars and simulate them. + AgentList * agentList = AgentList::getInstance(); + for(std::vector::iterator agent = agentList->getAgents().begin(); agent != agentList->getAgents().end(); agent++) { if (agent->getLinkedData() != NULL) { @@ -1376,7 +1375,7 @@ void idle(void) { agentHead->simulate(1.f/FPS); } } - */ + updateAvatarHand(1.f/FPS); diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index f3a29179d0..4c9164de0b 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -58,7 +58,7 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) { destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _bodyPitch); destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _bodyRoll); - //printf( "_bodyYaw = %f\n", _bodyYaw ); + //printf( "_bodyYaw = %f", _bodyYaw ); memcpy(destinationBuffer, &_handPosition, sizeof(float) * 3); destinationBuffer += sizeof(float) * 3;