This commit is contained in:
Nikolay Korolev 2021-01-11 20:51:18 +03:00
parent 08e5c8e010
commit 31dd135075

View file

@ -2415,7 +2415,7 @@ void CCarCtrl::SteerAICarWithPhysicsHeadingForTarget(CVehicle* pVehicle, CPhysic
*pHandbrake = true; *pHandbrake = true;
float maxAngle = FindMaxSteerAngle(pVehicle); float maxAngle = FindMaxSteerAngle(pVehicle);
steerAngle = Min(maxAngle, Max(-maxAngle, steerAngle)); steerAngle = Min(maxAngle, Max(-maxAngle, steerAngle));
float speedMultiplier = FindSpeedMultiplier(angleToTarget - angleForward, float speedMultiplier = FindSpeedMultiplier(CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y) - angleForward,
MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT); MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
float speedTarget = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier; float speedTarget = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier;
float currentSpeed = pVehicle->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_CARAI_SPEED; float currentSpeed = pVehicle->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_CARAI_SPEED;