added _isMine check for my _bodyYaw update

This commit is contained in:
Jeffrey Ventrella 2013-04-17 18:10:32 -07:00
parent de3de7b878
commit 4e12f26467
3 changed files with 11 additions and 13 deletions

View file

@ -388,6 +388,7 @@ void Head::simulate(float deltaTime) {
} }
} }
//---------------------------------------------------------- //----------------------------------------------------------
float translationalSpeed = glm::length( _avatar.velocity ); float translationalSpeed = glm::length( _avatar.velocity );
float rotationalSpeed = fabs( _bodyYawDelta ); float rotationalSpeed = fabs( _bodyYawDelta );
@ -403,8 +404,10 @@ void Head::simulate(float deltaTime) {
//---------------------------------------------------------- //----------------------------------------------------------
// update body yaw by body yaw delta // update body yaw by body yaw delta
//---------------------------------------------------------- //----------------------------------------------------------
if (_isMine) {
_bodyYaw += _bodyYawDelta * deltaTime; _bodyYaw += _bodyYawDelta * deltaTime;
}
//---------------------------------------------------------- //----------------------------------------------------------
// (for now) set head yaw to body yaw // (for now) set head yaw to body yaw
//---------------------------------------------------------- //----------------------------------------------------------
@ -414,12 +417,12 @@ void Head::simulate(float deltaTime) {
// decay body yaw delta // decay body yaw delta
//---------------------------------------------------------- //----------------------------------------------------------
const float TEST_YAW_DECAY = 5.0; 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 // add thrust to velocity
//---------------------------------------------------------- //----------------------------------------------------------
_avatar.velocity += glm::dvec3( _avatar.thrust * deltaTime ); _avatar.velocity += glm::dvec3(_avatar.thrust * deltaTime);
//---------------------------------------------------------- //----------------------------------------------------------
// update position by velocity // update position by velocity
@ -432,8 +435,6 @@ void Head::simulate(float deltaTime) {
const float LIN_VEL_DECAY = 5.0; const float LIN_VEL_DECAY = 5.0;
_avatar.velocity *= ( 1.0 - LIN_VEL_DECAY * deltaTime ); _avatar.velocity *= ( 1.0 - LIN_VEL_DECAY * deltaTime );
if (!noise) { if (!noise) {
// Decay back toward center // Decay back toward center
Pitch *= (1.f - DECAY*2*deltaTime); Pitch *= (1.f - DECAY*2*deltaTime);
@ -450,8 +451,6 @@ void Head::simulate(float deltaTime) {
leanForward *= (1.f - DECAY*30.f*deltaTime); leanForward *= (1.f - DECAY*30.f*deltaTime);
leanSideways *= (1.f - DECAY*30.f*deltaTime); leanSideways *= (1.f - DECAY*30.f*deltaTime);
// Update where the avatar's eyes are // Update where the avatar's eyes are
// //
// First, decide if we are making eye contact or not // First, decide if we are making eye contact or not

View file

@ -1365,10 +1365,9 @@ void idle(void) {
// //
updateAvatar( 1.f/FPS ); updateAvatar( 1.f/FPS );
//loop through all the other avatars and simulate them.
//test AgentList * agentList = AgentList::getInstance();
/* for(std::vector<Agent>::iterator agent = agentList->getAgents().begin(); agent != agentList->getAgents().end(); agent++)
for(std::vector<Agent>::iterator agent = agentList.getAgents().begin(); agent != agentList.getAgents().end(); agent++)
{ {
if (agent->getLinkedData() != NULL) if (agent->getLinkedData() != NULL)
{ {
@ -1376,7 +1375,7 @@ void idle(void) {
agentHead->simulate(1.f/FPS); agentHead->simulate(1.f/FPS);
} }
} }
*/
updateAvatarHand(1.f/FPS); updateAvatarHand(1.f/FPS);

View file

@ -58,7 +58,7 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _bodyPitch); destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _bodyPitch);
destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _bodyRoll); destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _bodyRoll);
//printf( "_bodyYaw = %f\n", _bodyYaw ); //printf( "_bodyYaw = %f", _bodyYaw );
memcpy(destinationBuffer, &_handPosition, sizeof(float) * 3); memcpy(destinationBuffer, &_handPosition, sizeof(float) * 3);
destinationBuffer += sizeof(float) * 3; destinationBuffer += sizeof(float) * 3;