From 2de3c6d67bc0a30edd9ec5b4dd089a48bc19cb5d Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Mon, 8 Jun 2020 02:34:53 +0300 Subject: some fixes to heli AI (not all yet) --- src/control/CarCtrl.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 38a242b4..1ad57392 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -2690,7 +2690,7 @@ void CCarCtrl::SteerAIHeliTowardsTargetCoors(CAutomobile* pHeli) if (Abs(ZSpeedChangeTarget) < ZSpeedChangeMax) pHeli->SetMoveSpeed(pHeli->GetMoveSpeed().x, pHeli->GetMoveSpeed().y, ZSpeedTarget); else if (ZSpeedChangeTarget < 0.0f) - pHeli->AddToMoveSpeed(0.0f, 0.0f, 1.5f * ZSpeedChangeMax); + pHeli->AddToMoveSpeed(0.0f, 0.0f, -1.5f * ZSpeedChangeMax); else pHeli->AddToMoveSpeed(0.0f, 0.0f, ZSpeedChangeMax); } @@ -2715,6 +2715,13 @@ void CCarCtrl::SteerAIHeliTowardsTargetCoors(CAutomobile* pHeli) ZTurnSpeedTarget = -0.03f; } float ZTurnSpeedChangeTarget = ZTurnSpeedTarget - pHeli->GetTurnSpeed().z; + float ZTurnSpeedLimit = 0.0002f * CTimer::GetTimeStep(); + if (Abs(ZTurnSpeedChangeTarget) < ZTurnSpeedLimit) + pHeli->m_vecTurnSpeed.z = ZTurnSpeedTarget; + else if (ZTurnSpeedChangeTarget < 0.0f) + pHeli->m_vecTurnSpeed.z -= ZTurnSpeedLimit; + else + pHeli->m_vecTurnSpeed.z += ZTurnSpeedLimit; pHeli->m_fOrientation += pHeli->GetTurnSpeed().z * CTimer::GetTimeStep(); CVector up; if (pHeli->bHeliMinimumTilt) -- cgit v1.2.3