From 800e93110462e1d6b91c09f1efe3164733006fc6 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 17 Feb 2011 13:01:29 -0500 Subject: Another part of the pelvis fix. Sh-634 --- indra/newview/llvoavatar.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 439584c7e8..b90c136b21 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1332,14 +1332,26 @@ const LLVector3 LLVOAvatar::getRenderPosition() const } else if (isRoot()) { + //Rebase the pelvis position if the avatar contains a pelvis offset if ( mHasPelvisOffset ) { LLVector3 returnVec( mDrawable->getPositionAgent() ); - //1. Move the pelvis down by the old amount - returnVec[VZ] -= (mLastPelvisToFoot); - //2. Now move the pelvis up by the new amount - returnVec[VZ] += mPelvisToFoot; - //3. Return the fixed up pelvis position + if ( mLastPelvisToFoot > mPelvisToFoot ) + { + F32 diff = mLastPelvisToFoot - mPelvisToFoot; + //1. Move the pelvis down by the difference of the old amount and the new pelvis to foot amount + returnVec[VZ] -= (diff); + //2. Now move the pelvis up by the new pelvis to foot amount + returnVec[VZ] += mPelvisToFoot; + } + else + { + //1. Move the pelvis down by the old pelvis to foot amount + returnVec[VZ] -= (mLastPelvisToFoot); + //2. Now move the pelvis up by the new pelvis to foot amount + returnVec[VZ] += mPelvisToFoot; + } + //Return the fixed up pelvis position return returnVec; } else -- cgit v1.2.3