mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 12:58:00 +03:00
Merge branch 'turnedwerewolf' into 'master'
Some checks are pending
Build and test / MacOS (push) Waiting to run
Build and test / Read .env file and expose it as output (push) Waiting to run
Build and test / Windows (2019) (push) Blocked by required conditions
Build and test / Windows (2022) (push) Blocked by required conditions
Build and test / Ubuntu (push) Waiting to run
Some checks are pending
Build and test / MacOS (push) Waiting to run
Build and test / Read .env file and expose it as output (push) Waiting to run
Build and test / Windows (2019) (push) Blocked by required conditions
Build and test / Windows (2022) (push) Blocked by required conditions
Build and test / Ubuntu (push) Waiting to run
Remove completion threshold-based turning for the player (#8447) Closes #8447 See merge request OpenMW/openmw!4628
This commit is contained in:
commit
49c4862410
1 changed files with 14 additions and 34 deletions
|
@ -2301,17 +2301,13 @@ namespace MWMechanics
|
|||
}
|
||||
else
|
||||
{
|
||||
// Do not play turning animation for player if rotation speed is very slow.
|
||||
// Actual threshold should take framerate in account.
|
||||
float rotationThreshold = (isPlayer ? 0.015f : 0.001f) * 60 * duration;
|
||||
|
||||
// It seems only bipedal actors use turning animations.
|
||||
// Also do not use turning animations in the first-person view and when sneaking.
|
||||
if (!sneak && !isFirstPersonPlayer && isBiped)
|
||||
{
|
||||
if (effectiveRotation > rotationThreshold)
|
||||
if (effectiveRotation > 0.f)
|
||||
movestate = inwater ? CharState_SwimTurnRight : CharState_TurnRight;
|
||||
else if (effectiveRotation < -rotationThreshold)
|
||||
else if (effectiveRotation < 0.f)
|
||||
movestate = inwater ? CharState_SwimTurnLeft : CharState_TurnLeft;
|
||||
}
|
||||
}
|
||||
|
@ -2337,34 +2333,19 @@ namespace MWMechanics
|
|||
vec.y() *= std::sqrt(1.0f - swimUpwardCoef * swimUpwardCoef);
|
||||
}
|
||||
|
||||
// Player can not use smooth turning as NPCs, so we play turning animation a bit to avoid jittering
|
||||
if (isPlayer)
|
||||
if (isBiped)
|
||||
{
|
||||
float threshold = mCurrentMovement.find("swim") == std::string::npos ? 0.4f : 0.8f;
|
||||
float complete;
|
||||
bool animPlaying = mAnimation->getInfo(mCurrentMovement, &complete);
|
||||
if (movestate == CharState_None && jumpstate == JumpState_None && isTurning())
|
||||
{
|
||||
if (animPlaying && complete < threshold)
|
||||
movestate = mMovementState;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isBiped)
|
||||
{
|
||||
if (mTurnAnimationThreshold > 0)
|
||||
mTurnAnimationThreshold -= duration;
|
||||
if (mTurnAnimationThreshold > 0)
|
||||
mTurnAnimationThreshold -= duration;
|
||||
|
||||
if (movestate == CharState_TurnRight || movestate == CharState_TurnLeft
|
||||
|| movestate == CharState_SwimTurnRight || movestate == CharState_SwimTurnLeft)
|
||||
{
|
||||
mTurnAnimationThreshold = 0.05f;
|
||||
}
|
||||
else if (movestate == CharState_None && isTurning() && mTurnAnimationThreshold > 0)
|
||||
{
|
||||
movestate = mMovementState;
|
||||
}
|
||||
if (movestate == CharState_TurnRight || movestate == CharState_TurnLeft
|
||||
|| movestate == CharState_SwimTurnRight || movestate == CharState_SwimTurnLeft)
|
||||
{
|
||||
mTurnAnimationThreshold = 0.05f;
|
||||
}
|
||||
else if (movestate == CharState_None && isTurning() && mTurnAnimationThreshold > 0)
|
||||
{
|
||||
movestate = mMovementState;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2393,11 +2374,10 @@ namespace MWMechanics
|
|||
|
||||
if (isTurning())
|
||||
{
|
||||
// Adjust animation speed from 1.0 to 1.5 multiplier
|
||||
if (duration > 0)
|
||||
{
|
||||
float turnSpeed = std::min(1.5f, std::abs(rot.z()) / duration / static_cast<float>(osg::PI));
|
||||
mAnimation->adjustSpeedMult(mCurrentMovement, std::max(turnSpeed, 1.0f));
|
||||
mAnimation->adjustSpeedMult(mCurrentMovement, turnSpeed);
|
||||
}
|
||||
}
|
||||
else if (mMovementState != CharState_None && mAdjustMovementAnimSpeed)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue