From 0815650c3e3d69cff18d88034daa11b61d0a9657 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 10 Nov 2010 14:43:23 -0500 Subject: Bug fix for an avatar that would exhibit floating if pelvis was offset Bug fix for attach/detach so that it will recalculate certain avatar settings based upon bone positions. --- indra/newview/llvoavatar.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b6d1d2443d..43a9e29f4b 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3477,7 +3477,14 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // correct for the fact that the pelvis is not necessarily the center // of the agent's physical representation - root_pos.mdV[VZ] -= (0.5f * mBodySize.mV[VZ]) - mPelvisToFoot; + if ( !mHasPelvisOffset ) + { + root_pos.mdV[VZ] -= (0.5f * mBodySize.mV[VZ]) - mPelvisToFoot; + } + else + { + root_pos.mdV[VZ] -= (0.5f * mBodySize.mV[VZ]) - mPelvisToFoot; + } LLVector3 newPosition = gAgent.getPosAgentFromGlobal(root_pos); @@ -3805,7 +3812,16 @@ void LLVOAvatar::setPelvisOffset( bool hasOffset, const LLVector3& offsetAmount mPelvisOffset = offsetAmount; } } - +//------------------------------------------------------------------------ +// postPelvisSetRecalc +//------------------------------------------------------------------------ +void LLVOAvatar::postPelvisSetRecalc( void ) +{ + computeBodySize(); + mRoot.updateWorldMatrixChildren(); + dirtyMesh(); + updateHeadOffset(); +} //------------------------------------------------------------------------ // updateVisibility() //------------------------------------------------------------------------ @@ -4976,6 +4992,7 @@ void LLVOAvatar::resetJointPositionsToDefault( void ) } //make sure we don't apply the joint offset mHasPelvisOffset = false; + postPelvisSetRecalc(); } -- cgit v1.2.3 From 2551bfb1b523c1ce2459e0139829a211c36e1bcc Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 10 Nov 2010 14:46:36 -0500 Subject: cleanup --- indra/newview/llvoavatar.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 43a9e29f4b..bb28b09200 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3476,16 +3476,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) mInAir = in_air; // correct for the fact that the pelvis is not necessarily the center - // of the agent's physical representation - if ( !mHasPelvisOffset ) - { - root_pos.mdV[VZ] -= (0.5f * mBodySize.mV[VZ]) - mPelvisToFoot; - } - else - { - root_pos.mdV[VZ] -= (0.5f * mBodySize.mV[VZ]) - mPelvisToFoot; - } - + // of the agent's physical representation + root_pos.mdV[VZ] -= (0.5f * mBodySize.mV[VZ]) - mPelvisToFoot; LLVector3 newPosition = gAgent.getPosAgentFromGlobal(root_pos); -- cgit v1.2.3