Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 941afb2

Browse files
committed
Smooth stance transition during throwing chargeup
1 parent de2ab0e commit 941afb2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Entities/AHuman.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3413,16 +3413,15 @@ void AHuman::Update()
34133413
m_ThrowTmr.Reset();
34143414
if (!pThrown->ActivatesWhenReleased()) { pThrown->Activate(); }
34153415
}
3416+
float throwProgress = GetThrowProgress();
34163417
m_ArmsState = THROWING_PREP;
3417-
m_pFGArm->ReachToward(m_pFGArm->GetJointPos() + pThrown->GetStartThrowOffset().RadRotate(m_AimAngle + m_AngularVel * deltaTime).GetXFlipped(m_HFlipped));
3418+
m_pFGArm->ReachToward(m_pFGArm->GetJointPos() + (pThrown->GetStartThrowOffset().GetXFlipped(m_HFlipped) * throwProgress + pThrown->GetStanceOffset() * (1.0F - throwProgress)).RadRotate(adjustedAimAngle));
34183419
} else if (m_ArmsState == THROWING_PREP) {
34193420
m_ArmsState = THROWING_RELEASE;
34203421
// TODO: figure out how to properly use EndThrowOffset, since it doesn't play much a role for just one frame!
34213422
m_pFGArm->SetHandPos(m_pFGArm->GetJointPos() + pThrown->GetEndThrowOffset().RadRotate(adjustedAimAngle).GetXFlipped(m_HFlipped));
34223423

3423-
MovableObject *pMO = m_pFGArm->ReleaseHeldMO();
3424-
3425-
if (pMO) {
3424+
if (MovableObject *pMO = m_pFGArm->ReleaseHeldMO()) {
34263425
pMO->SetPos(m_pFGArm->GetJointPos() + Vector(m_pFGArm->GetMaxLength() * GetFlipFactor(), -m_pFGArm->GetMaxLength() * 0.5F).RadRotate(adjustedAimAngle));
34273426
float maxThrowVel = pThrown->GetMaxThrowVel();
34283427
float minThrowVel = pThrown->GetMinThrowVel();
@@ -3858,7 +3857,8 @@ void AHuman::Update()
38583857
HeldDevice *heldDevice = dynamic_cast<HeldDevice *>(GetEquippedItem());
38593858
ThrownDevice *thrownDevice = dynamic_cast<ThrownDevice *>(heldDevice);
38603859
if (thrownDevice && (m_ArmsState == THROWING_PREP || isSharpAiming)) {
3861-
m_pBGArm->ReachToward(m_pBGArm->GetJointPos() + thrownDevice->GetEndThrowOffset().RadRotate(m_AimAngle).GetXFlipped(m_HFlipped));
3860+
float throwProgress = isSharpAiming ? 1.0F : GetThrowProgress();
3861+
m_pBGArm->ReachToward(m_pBGArm->GetJointPos() + (thrownDevice->GetEndThrowOffset().GetXFlipped(m_HFlipped) * throwProgress + (thrownDevice->GetStanceOffset() + thrownDevice->GetSupportOffset().GetXFlipped(m_HFlipped)) * (1.0F - throwProgress)).RadRotate(adjustedAimAngle));
38623862
} else if (heldDevice) {
38633863
if (GetEquippedBGItem() && !heldDevice->IsOneHanded()) {
38643864
UnequipBGArm();

0 commit comments

Comments
 (0)