Exemple #1
0
    public override void OnPlayerControlTick(Player owner)
    {
        base.OnPlayerControlTick(owner);

        //DebugTrace( owner );
        return;

        if (!NavMesh.IsLoaded)
        {
            return;
        }

        timeSinceLast = 0;

        var forward = owner.EyeRot.Forward * 2000;


        var tr = Trace.Ray(owner.EyePos, owner.EyePos + forward)
                 .Ignore(owner)
                 .Run();

        var closestPoint = NavMesh.GetClosestPoint(tr.EndPos);

        DebugOverlay.Line(tr.EndPos, closestPoint, 0.1f);

        DebugOverlay.Axis(closestPoint, Rotation.LookAt(tr.Normal), 2.0f, Time.Delta * 2);
        DebugOverlay.Text(closestPoint, $"CLOSEST Walkable POINT", Time.Delta * 2);

        NavMesh.BuildPath(Owner.WorldPos, closestPoint);
    }