Beispiel #1
0
    private void Update()
    {
        float t = (Time.time - flightStartTime) * Speed;

        if (splineBuilder.IsFinishedAtTime(t))
        {
            CancelFlight();
            return;
        }

        Vector3 lookDirection = splineBuilder.GetSpeedAtTime(t).normalized;

        lookDirection.y = 0;

        transform.position = splineBuilder.GetPositionAtTime(t);
        ModelRoot.rotation = Quaternion.Lerp(ModelRoot.rotation,
                                             Quaternion.LookRotation(lookDirection),
                                             Time.deltaTime);
    }
Beispiel #2
0
    private void OnTimelineValueChanged(float value)
    {
        float splineTime = _frames.GetSplineTimeAtNormalizedTime(value);

        EventBus.Instance.OnCurrentWaypointChange.Invoke(splineBuilder.GetPositionAtTime(splineTime));
    }