| 3533 | //---------------------------------------------------------------------------- |
| 3534 | |
| 3535 | void Player::updateLookAnimation(F32 dt) |
| 3536 | { |
| 3537 | // If the preference setting overrideLookAnimation is true, the player's |
| 3538 | // arm and head no longer animate according to the view direction. They |
| 3539 | // are instead given fixed positions. |
| 3540 | if (overrideLookAnimation) |
| 3541 | { |
| 3542 | if (mArmAnimation.thread) |
| 3543 | mShapeInstance->setPos(mArmAnimation.thread, armLookOverridePos); |
| 3544 | if (mHeadVThread) |
| 3545 | mShapeInstance->setPos(mHeadVThread, headVLookOverridePos); |
| 3546 | if (mHeadHThread) |
| 3547 | mShapeInstance->setPos(mHeadHThread, headHLookOverridePos); |
| 3548 | return; |
| 3549 | } |
| 3550 | // Calculate our interpolated head position. |
| 3551 | Point3F renderHead = mDelta.head + mDelta.headVec * dt; |
| 3552 | |
| 3553 | // Adjust look pos. This assumes that the animations match |
| 3554 | // the min and max look angles provided in the datablock. |
| 3555 | if (mArmAnimation.thread) |
| 3556 | { |
| 3557 | if(mControlObject) |
| 3558 | { |
| 3559 | mShapeInstance->setPos(mArmAnimation.thread,0.5f); |
| 3560 | } |
| 3561 | else |
| 3562 | { |
| 3563 | F32 d = mDataBlock->maxLookAngle - mDataBlock->minLookAngle; |
| 3564 | F32 tp = (renderHead.x - mDataBlock->minLookAngle) / d; |
| 3565 | mShapeInstance->setPos(mArmAnimation.thread,mClampF(tp,0,1)); |
| 3566 | } |
| 3567 | } |
| 3568 | |
| 3569 | if (mHeadVThread) |
| 3570 | { |
| 3571 | F32 d = mDataBlock->maxLookAngle - mDataBlock->minLookAngle; |
| 3572 | F32 tp = (renderHead.x - mDataBlock->minLookAngle) / d; |
| 3573 | mShapeInstance->setPos(mHeadVThread,mClampF(tp,0,1)); |
| 3574 | } |
| 3575 | |
| 3576 | if (mHeadHThread) |
| 3577 | { |
| 3578 | F32 d = 2 * mDataBlock->maxFreelookAngle; |
| 3579 | F32 tp = (renderHead.z + mDataBlock->maxFreelookAngle) / d; |
| 3580 | mShapeInstance->setPos(mHeadHThread,mClampF(tp,0,1)); |
| 3581 | } |
| 3582 | } |
| 3583 | |
| 3584 | |
| 3585 | //---------------------------------------------------------------------------- |