Files

34 lines
1014 B
C#
Raw Permalink Normal View History

2026-03-19 02:02:28 +03:00
using UnityEngine;
using System.Collections;
public class PathFollower : Seek
{
public Path path;
public float pathOffset = 0.0f;
float currentParam;
public override void Awake()
{
base.Awake();
target = new GameObject();
currentParam = 0f;
}
public override Steering GetSteering()
{
currentParam = path.GetParam(transform.position, currentParam);
float targetParam = currentParam + pathOffset;
2026-03-20 00:22:54 +03:00
// Получаем позицию цели от пути
Vector3 targetPosition = path.GetPosition(targetParam);
// **ИСПРАВЛЕНИЕ "ПОЛЕТОВ"**
// Принудительно ставим цель на ту же высоту, что и агент
targetPosition.y = transform.position.y;
// Устанавливаем позицию цели для Seek
target.transform.position = targetPosition;
2026-03-19 02:02:28 +03:00
return base.GetSteering();
}
}