mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
commit
5ca66697b1
2 changed files with 16 additions and 30 deletions
|
|
@ -128,14 +128,6 @@ enum PlayerConstants {
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Player shape animation sequences:
|
// Player shape animation sequences:
|
||||||
|
|
||||||
// look Used to control the upper body arm motion. Must animate
|
|
||||||
// vertically +-80 deg.
|
|
||||||
Player::Range Player::mArmRange(mDegToRad(-80.0f),mDegToRad(+80.0f));
|
|
||||||
|
|
||||||
// head Used to control the direction the head is looking. Must
|
|
||||||
// animated vertically +-80 deg .
|
|
||||||
Player::Range Player::mHeadVRange(mDegToRad(-80.0f),mDegToRad(+80.0f));
|
|
||||||
|
|
||||||
// Action Animations:
|
// Action Animations:
|
||||||
PlayerData::ActionAnimationDef PlayerData::ActionAnimationList[NumTableActionAnims] =
|
PlayerData::ActionAnimationDef PlayerData::ActionAnimationList[NumTableActionAnims] =
|
||||||
{
|
{
|
||||||
|
|
@ -3431,31 +3423,38 @@ void Player::updateDamageState()
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void Player::updateLookAnimation(F32 dT)
|
void Player::updateLookAnimation(F32 dt)
|
||||||
{
|
{
|
||||||
// Calculate our interpolated head position.
|
// Calculate our interpolated head position.
|
||||||
Point3F renderHead = delta.head + delta.headVec * dT;
|
Point3F renderHead = delta.head + delta.headVec * dt;
|
||||||
|
|
||||||
// Adjust look pos. This assumes that the animations match
|
// Adjust look pos. This assumes that the animations match
|
||||||
// the min and max look angles provided in the datablock.
|
// the min and max look angles provided in the datablock.
|
||||||
if (mArmAnimation.thread)
|
if (mArmAnimation.thread)
|
||||||
{
|
{
|
||||||
// TG: Adjust arm position to avoid collision.
|
if(mControlObject)
|
||||||
F32 tp = mControlObject? 0.5:
|
{
|
||||||
(renderHead.x - mArmRange.min) / mArmRange.delta;
|
mShapeInstance->setPos(mArmAnimation.thread,0.5f);
|
||||||
mShapeInstance->setPos(mArmAnimation.thread,mClampF(tp,0,1));
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
F32 d = mDataBlock->maxLookAngle - mDataBlock->minLookAngle;
|
||||||
|
F32 tp = (renderHead.x - mDataBlock->minLookAngle) / d;
|
||||||
|
mShapeInstance->setPos(mArmAnimation.thread,mClampF(tp,0,1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mHeadVThread)
|
if (mHeadVThread)
|
||||||
{
|
{
|
||||||
F32 tp = (renderHead.x - mHeadVRange.min) / mHeadVRange.delta;
|
F32 d = mDataBlock->maxLookAngle - mDataBlock->minLookAngle;
|
||||||
|
F32 tp = (renderHead.x - mDataBlock->minLookAngle) / d;
|
||||||
mShapeInstance->setPos(mHeadVThread,mClampF(tp,0,1));
|
mShapeInstance->setPos(mHeadVThread,mClampF(tp,0,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mHeadHThread)
|
if (mHeadHThread)
|
||||||
{
|
{
|
||||||
F32 dt = 2 * mDataBlock->maxFreelookAngle;
|
F32 d = 2 * mDataBlock->maxFreelookAngle;
|
||||||
F32 tp = (renderHead.z + mDataBlock->maxFreelookAngle) / dt;
|
F32 tp = (renderHead.z + mDataBlock->maxFreelookAngle) / d;
|
||||||
mShapeInstance->setPos(mHeadHThread,mClampF(tp,0,1));
|
mShapeInstance->setPos(mHeadHThread,mClampF(tp,0,1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -398,16 +398,6 @@ protected:
|
||||||
NextFreeMask = Parent::NextFreeMask << 3
|
NextFreeMask = Parent::NextFreeMask << 3
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Range {
|
|
||||||
Range(F32 _min,F32 _max) {
|
|
||||||
min = _min;
|
|
||||||
max = _max;
|
|
||||||
delta = _max - _min;
|
|
||||||
};
|
|
||||||
F32 min,max;
|
|
||||||
F32 delta;
|
|
||||||
};
|
|
||||||
|
|
||||||
SimObjectPtr<ParticleEmitter> mSplashEmitter[PlayerData::NUM_SPLASH_EMITTERS];
|
SimObjectPtr<ParticleEmitter> mSplashEmitter[PlayerData::NUM_SPLASH_EMITTERS];
|
||||||
F32 mBubbleEmitterTime;
|
F32 mBubbleEmitterTime;
|
||||||
|
|
||||||
|
|
@ -508,9 +498,6 @@ protected:
|
||||||
TSThread* mHeadHThread;
|
TSThread* mHeadHThread;
|
||||||
TSThread* mRecoilThread;
|
TSThread* mRecoilThread;
|
||||||
TSThread* mImageStateThread;
|
TSThread* mImageStateThread;
|
||||||
static Range mArmRange;
|
|
||||||
static Range mHeadVRange;
|
|
||||||
static Range mHeadHRange;
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
bool mInMissionArea; ///< Are we in the mission area?
|
bool mInMissionArea; ///< Are we in the mission area?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue