summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r--indra/newview/llvoavatar.cpp41
1 files changed, 36 insertions, 5 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 46c0fdf03e..b6d1d2443d 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -682,7 +682,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
mPreviousFullyLoaded(FALSE),
mFullyLoadedInitialized(FALSE),
mSupportsAlphaLayers(FALSE),
- mLoadedCallbacksPaused(FALSE)
+ mLoadedCallbacksPaused(FALSE),
+ mHasPelvisOffset( FALSE )
{
LLMemType mt(LLMemType::MTYPE_AVATAR);
//VTResume(); // VTune
@@ -758,6 +759,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
mRuthTimer.reset();
mRuthDebugTimer.reset();
mDebugExistenceTimer.reset();
+ mPelvisOffset = LLVector3(0.0f,0.0f,0.0f);
}
//------------------------------------------------------------------------
@@ -3449,8 +3451,15 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
LLVector3d ground_under_pelvis;
if (isSelf())
- {
- gAgent.setPositionAgent(getRenderPosition());
+ {
+ if ( !mHasPelvisOffset )
+ {
+ gAgent.setPositionAgent(getRenderPosition());
+ }
+ else
+ {
+ gAgent.setPositionAgent( getRenderPosition() + mPelvisOffset );
+ }
}
root_pos = gAgent.getPosGlobalFromAgent(getRenderPosition());
@@ -3475,8 +3484,16 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
if (newPosition != mRoot.getXform()->getWorldPosition())
{
- mRoot.touch();
- mRoot.setWorldPosition(newPosition ); // regular update
+ if ( !mHasPelvisOffset )
+ {
+ mRoot.touch();
+ mRoot.setWorldPosition( newPosition ); // regular update
+ }
+ else
+ {
+ mRoot.touch();
+ mRoot.setWorldPosition( newPosition + mPelvisOffset );
+ }
}
@@ -3777,6 +3794,17 @@ void LLVOAvatar::updateHeadOffset()
mHeadOffset = lerp(midEyePt, mHeadOffset, u);
}
}
+//------------------------------------------------------------------------
+// setPelvisOffset
+//------------------------------------------------------------------------
+void LLVOAvatar::setPelvisOffset( bool hasOffset, const LLVector3& offsetAmount )
+{
+ mHasPelvisOffset = hasOffset;
+ if ( mHasPelvisOffset )
+ {
+ mPelvisOffset = offsetAmount;
+ }
+}
//------------------------------------------------------------------------
// updateVisibility()
@@ -4915,6 +4943,7 @@ void LLVOAvatar::resetJointPositions( void )
{
mSkeleton[i].restoreOldXform();
}
+ mHasPelvisOffset = false;
}
//-----------------------------------------------------------------------------
// resetJointPositionsToDefault
@@ -4945,6 +4974,8 @@ void LLVOAvatar::resetJointPositionsToDefault( void )
pJoint->restoreToDefaultXform();
}
}
+ //make sure we don't apply the joint offset
+ mHasPelvisOffset = false;
}