summaryrefslogtreecommitdiff
path: root/indra/llcharacter/llkeyframewalkmotion.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2007-12-07 20:27:13 +0000
committerSteven Bennetts <steve@lindenlab.com>2007-12-07 20:27:13 +0000
commitb01d567a5d9e2b5dd28bcc7b3f474fabd93e7a2f (patch)
treec45377783f53f033d43a4d06d36bbeb2a7f7e79b /indra/llcharacter/llkeyframewalkmotion.cpp
parenta64f283477ea4db09c8b515ab94709e1fb5c82af (diff)
EFFECTIVE MERGE: merge release@73232 maint-viewer-2@75100 -> maint-viewer-2-merge
EFFECTIVE MERGE: merge -r 74370 library-update -> maint-viewer-2-merge ACTUAL MERGE: release@75267 maint-viewer-2-merge@75293 -> release
Diffstat (limited to 'indra/llcharacter/llkeyframewalkmotion.cpp')
-rw-r--r--indra/llcharacter/llkeyframewalkmotion.cpp43
1 files changed, 28 insertions, 15 deletions
diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp
index 9a49996ebd..0d7e34bb4f 100644
--- a/indra/llcharacter/llkeyframewalkmotion.cpp
+++ b/indra/llcharacter/llkeyframewalkmotion.cpp
@@ -143,6 +143,8 @@ LLWalkAdjustMotion::LLWalkAdjustMotion(const LLUUID &id) : LLMotion(id)
{
mLastTime = 0.f;
mName = "walk_adjust";
+
+ mPelvisState = new LLJointState;
}
//-----------------------------------------------------------------------------
@@ -155,15 +157,15 @@ LLMotion::LLMotionInitStatus LLWalkAdjustMotion::onInitialize(LLCharacter *chara
mRightAnkleJoint = mCharacter->getJoint("mAnkleRight");
mPelvisJoint = mCharacter->getJoint("mPelvis");
- mPelvisState.setJoint( mPelvisJoint );
+ mPelvisState->setJoint( mPelvisJoint );
if ( !mPelvisJoint )
{
llwarns << getName() << ": Can't get pelvis joint." << llendl;
return STATUS_FAILURE;
}
- mPelvisState.setUsage(LLJointState::POS);
- addJointState( &mPelvisState );
+ mPelvisState->setUsage(LLJointState::POS);
+ addJointState( mPelvisState );
return STATUS_SUCCESS;
}
@@ -178,7 +180,7 @@ BOOL LLWalkAdjustMotion::onActivate()
mAnimSpeed = 0.f;
mAvgSpeed = 0.f;
mRelativeDir = 1.f;
- mPelvisState.setPosition(LLVector3::zero);
+ mPelvisState->setPosition(LLVector3::zero);
// store ankle positions for next frame
mLastLeftAnklePos = mCharacter->getPosGlobalFromAgent(mLeftAnkleJoint->getWorldPosition());
mLastRightAnklePos = mCharacter->getPosGlobalFromAgent(mRightAnkleJoint->getWorldPosition());
@@ -271,7 +273,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
// calculate ideal pelvis offset so that foot is glued to ground and damp towards it
// the amount of foot slippage this frame + the offset applied last frame
- mPelvisOffset = mPelvisState.getPosition() + lerp(LLVector3::zero, footCorrection, LLCriticalDamp::getInterpolant(0.2f));
+ mPelvisOffset = mPelvisState->getPosition() + lerp(LLVector3::zero, footCorrection, LLCriticalDamp::getInterpolant(0.2f));
// pelvis drift (along walk direction)
mAvgCorrection = lerp(mAvgCorrection, footCorrection.mV[VX] * mRelativeDir, LLCriticalDamp::getInterpolant(0.1f));
@@ -319,7 +321,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
F32 drift_comp_max = llclamp(speed, 0.f, DRIFT_COMP_MAX_SPEED) / DRIFT_COMP_MAX_SPEED;
drift_comp_max *= DRIFT_COMP_MAX_TOTAL;
- LLVector3 currentPelvisPos = mPelvisState.getJoint()->getPosition();
+ LLVector3 currentPelvisPos = mPelvisState->getJoint()->getPosition();
// NB: this is an ADDITIVE amount that is accumulated every frame, so clamping it alone won't do the trick
// must clamp with absolute position of pelvis in mind
@@ -328,7 +330,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
mPelvisOffset.mV[VZ] = 0.f;
// set position
- mPelvisState.setPosition(mPelvisOffset);
+ mPelvisState->setPosition(mPelvisOffset);
mCharacter->setAnimationData("Pelvis Offset", &mPelvisOffset);
@@ -344,6 +346,17 @@ void LLWalkAdjustMotion::onDeactivate()
}
//-----------------------------------------------------------------------------
+// LLFlyAdjustMotion::LLFlyAdjustMotion()
+//-----------------------------------------------------------------------------
+LLFlyAdjustMotion::LLFlyAdjustMotion(const LLUUID &id)
+ : LLMotion(id)
+{
+ mName = "fly_adjust";
+
+ mPelvisState = new LLJointState;
+}
+
+//-----------------------------------------------------------------------------
// LLFlyAdjustMotion::onInitialize()
//-----------------------------------------------------------------------------
LLMotion::LLMotionInitStatus LLFlyAdjustMotion::onInitialize(LLCharacter *character)
@@ -351,15 +364,15 @@ LLMotion::LLMotionInitStatus LLFlyAdjustMotion::onInitialize(LLCharacter *charac
mCharacter = character;
LLJoint* pelvisJoint = mCharacter->getJoint("mPelvis");
- mPelvisState.setJoint( pelvisJoint );
+ mPelvisState->setJoint( pelvisJoint );
if ( !pelvisJoint )
{
llwarns << getName() << ": Can't get pelvis joint." << llendl;
return STATUS_FAILURE;
}
- mPelvisState.setUsage(LLJointState::POS | LLJointState::ROT);
- addJointState( &mPelvisState );
+ mPelvisState->setUsage(LLJointState::POS | LLJointState::ROT);
+ addJointState( mPelvisState );
return STATUS_SUCCESS;
}
@@ -369,8 +382,8 @@ LLMotion::LLMotionInitStatus LLFlyAdjustMotion::onInitialize(LLCharacter *charac
//-----------------------------------------------------------------------------
BOOL LLFlyAdjustMotion::onActivate()
{
- mPelvisState.setPosition(LLVector3::zero);
- mPelvisState.setRotation(LLQuaternion::DEFAULT);
+ mPelvisState->setPosition(LLVector3::zero);
+ mPelvisState->setRotation(LLQuaternion::DEFAULT);
mRoll = 0.f;
return TRUE;
}
@@ -392,11 +405,11 @@ BOOL LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask)
// llinfos << mRoll << llendl;
LLQuaternion roll(mRoll, LLVector3(0.f, 0.f, 1.f));
- mPelvisState.setRotation(roll);
+ mPelvisState->setRotation(roll);
// F32 lerp_amt = LLCriticalDamp::getInterpolant(0.2f);
//
-// LLVector3 pelvis_correction = mPelvisState.getPosition() - lerp(LLVector3::zero, mPelvisState.getJoint()->getPosition() + mPelvisState.getPosition(), lerp_amt);
-// mPelvisState.setPosition(pelvis_correction);
+// LLVector3 pelvis_correction = mPelvisState->getPosition() - lerp(LLVector3::zero, mPelvisState->getJoint()->getPosition() + mPelvisState->getPosition(), lerp_amt);
+// mPelvisState->setPosition(pelvis_correction);
return TRUE;
}