mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-21 09:11:33 +00:00
fix veritcal aiming
This commit is contained in:
parent
293a0f768c
commit
e2cd87fcc7
1 changed files with 10 additions and 13 deletions
|
@ -50,7 +50,6 @@ namespace MWMechanics
|
||||||
bool mForceNoShortcut;
|
bool mForceNoShortcut;
|
||||||
ESM::Position mShortcutFailPos;
|
ESM::Position mShortcutFailPos;
|
||||||
MWMechanics::Movement mMovement;
|
MWMechanics::Movement mMovement;
|
||||||
bool mAdjustAiming;
|
|
||||||
|
|
||||||
AiCombatStorage():
|
AiCombatStorage():
|
||||||
mAttackCooldown(0),
|
mAttackCooldown(0),
|
||||||
|
@ -67,8 +66,7 @@ namespace MWMechanics
|
||||||
mStrength(),
|
mStrength(),
|
||||||
mForceNoShortcut(false),
|
mForceNoShortcut(false),
|
||||||
mShortcutFailPos(),
|
mShortcutFailPos(),
|
||||||
mMovement(),
|
mMovement()
|
||||||
mAdjustAiming(false)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void startCombatMove(bool isNpc, bool isDistantCombat, float distToTarget, float rangeAttack);
|
void startCombatMove(bool isNpc, bool isDistantCombat, float distToTarget, float rangeAttack);
|
||||||
|
@ -255,12 +253,14 @@ namespace MWMechanics
|
||||||
vAimDir = AimDirToMovingTarget(actor, target, lastTargetPos, AI_REACTION_TIME, (weapon ? weapon->mData.mType : 0), storage.mStrength);
|
vAimDir = AimDirToMovingTarget(actor, target, lastTargetPos, AI_REACTION_TIME, (weapon ? weapon->mData.mType : 0), storage.mStrength);
|
||||||
lastTargetPos = vTargetPos;
|
lastTargetPos = vTargetPos;
|
||||||
|
|
||||||
MWMechanics::Movement& movement = storage.mMovement;
|
storage.mMovement.mRotation[0] = getXAngleToDir(vAimDir);
|
||||||
movement.mRotation[0] = getXAngleToDir(vAimDir);
|
storage.mMovement.mRotation[2] = getZAngleToDir(vAimDir);
|
||||||
movement.mRotation[2] = getZAngleToDir(vAimDir);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
storage.mMovement.mRotation[0] = getXAngleToDir(vAimDir);
|
||||||
|
storage.mMovement.mRotation[2] = getZAngleToDir((vTargetPos-vActorPos)); // using vAimDir results in spastic movements since the head is animated
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.mAdjustAiming = isRangedCombat;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,12 +272,9 @@ namespace MWMechanics
|
||||||
actorMovementSettings.mPosition[1] = storage.mMovement.mPosition[1];
|
actorMovementSettings.mPosition[1] = storage.mMovement.mPosition[1];
|
||||||
actorMovementSettings.mPosition[2] = storage.mMovement.mPosition[2];
|
actorMovementSettings.mPosition[2] = storage.mMovement.mPosition[2];
|
||||||
|
|
||||||
if (storage.mAdjustAiming)
|
|
||||||
{
|
|
||||||
rotateActorOnAxis(actor, 2, actorMovementSettings, storage.mMovement);
|
rotateActorOnAxis(actor, 2, actorMovementSettings, storage.mMovement);
|
||||||
rotateActorOnAxis(actor, 0, actorMovementSettings, storage.mMovement);
|
rotateActorOnAxis(actor, 0, actorMovementSettings, storage.mMovement);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void AiCombat::rotateActorOnAxis(const MWWorld::Ptr& actor, int axis,
|
void AiCombat::rotateActorOnAxis(const MWWorld::Ptr& actor, int axis,
|
||||||
MWMechanics::Movement& actorMovementSettings, MWMechanics::Movement& desiredMovement)
|
MWMechanics::Movement& actorMovementSettings, MWMechanics::Movement& desiredMovement)
|
||||||
|
|
Loading…
Reference in a new issue