Начинающий
- Статус
- Оффлайн
- Регистрация
- 23 Июн 2025
- Сообщения
- 43
- Реакции
- 0
- Выберите загрузчик игры
- Vanilla
Код:
case "Ai" -> {
yawDelta = MathHelper.wrapDegrees(yawToTarget - rotateVector.x);
pitchDelta = MathHelper.wrapDegrees(pitchToTarget - rotateVector.y);
float distance = (float) Math.hypot(yawDelta, pitchDelta);
float smoothExp = MathHelper.clamp(distance / 15f, 0.15f, 0.75f);
float jitterYaw = (float) ((Math.random() - 0.5) * 1.2f);
float jitterPitch = (float) ((Math.random() - 0.5) * 0.3f);
float nextYaw = rotateVector.x + (yawDelta * (smoothExp * 1f)) + jitterYaw;
float nextPitch = rotateVector.y + (pitchDelta * (smoothExp * 0.6f)) + jitterPitch;
float gcd = SensUtils.getGCDValue();
nextYaw -= (nextYaw - rotateVector.x) % gcd;
nextPitch -= (nextPitch - rotateVector.y) % gcd;
rotateVector = new Vector2f(nextYaw, MathHelper.clamp(nextPitch, -90, 90));
}