Table of Contents

Example - Cinematic Sequence

You want an opening cutscene, a scripted reveal, or a mission flyby.

Animations of different types run together: a single animationTime shared across MoveCameraTo, RotateAndTiltCameraTo, and ZoomCameraTo gives you one composed shot. To string several shots together, drive them from a coroutine and yield for the duration of each.

using System.Collections;
using UnityEngine;
using Goehler.OrbitalCam;

public class CameraTour : MonoBehaviour {

    [System.Serializable]
    public struct Shot {
        public Vector3 position;
        public Vector2 rotationAndTilt;
        public float zoom;
        public float duration;
        public float hold;
        public EasingType easing;
    }

    [SerializeField] private OrbitalCameraSystem _camera;
    [SerializeField] private Shot[] _shots;

    public IEnumerator Play() {
        foreach (Shot shot in _shots) {
            _camera.MoveCameraTo(shot.position, shot.duration, shot.easing);
            _camera.RotateAndTiltCameraTo(shot.rotationAndTilt, shot.duration, shot.easing);
            _camera.ZoomCameraTo(shot.zoom, shot.duration, shot.easing);
            yield return new WaitForSeconds(shot.duration + shot.hold);
        }
    }
}

Author the shots in the Inspector. Each Shot describes where the camera should be, how long to glide there, and how long to hold before moving to the next. Kick the sequence off with StartCoroutine(Play()).

Picking easing per shot lets you mix curves: Linear for constant-velocity moves, EaseInOut for smooth starts and stops, EaseIn / EaseOut for arrivals or departures. The struct field defaults to Linear.

Note

Animations of the same type cannot stack. Calling MoveCameraTo twice without waiting only honours the second call; the first is overwritten mid-flight. That's why the yield return new WaitForSeconds(shot.duration + ...) is required: it's how you tell the next shot to wait its turn.

Note

Pair this with Pause Input so the player can't fight the animation. Disable input at the start of Play, re-enable it after the last shot finishes.

This pattern is wired up in the Island City Builder scene. Hit Play and click the Play Tour button. The demo extends the basic pattern above with concurrent fade transitions and hard-cut shots; see CameraTourDemo.cs for the full version.