Table of Contents

Example - Important Event

You want the camera to snap onto something the player should look at right now—a building on fire, a battle starting, a wedding kicking off, a unit under attack.

The basic shape: when your event fires, animate the camera to the world position with MoveCameraTo. Add RotateAndTiltCameraTo and ZoomCameraTo when you want a specific framing.

using UnityEngine;
using Goehler.OrbitalCam;

public class EventCameraFocus : MonoBehaviour {

    [SerializeField] private OrbitalCameraSystem _camera;
    [SerializeField] private float _focusTime = 1.5f;
    [SerializeField] private float _focusZoom = 12f;
    [SerializeField] private Vector2 _focusAngles = new Vector2(0f, 45f);

    public void FocusOn(Transform eventTarget) {
        _camera.MoveCameraTo(eventTarget.position, _focusTime);
        _camera.RotateAndTiltCameraTo(_focusAngles, _focusTime);
        _camera.ZoomCameraTo(_focusZoom, _focusTime);
    }
}

Call FocusOn(...) from wherever the event triggers: a UnityEvent on a button, a custom event channel, an OnTriggerEnter, anywhere. Pass the transform you want the camera over (a building, a unit, an effect spawner).

Note

Animations of different types run together. That's why the three calls above all play simultaneously and end at the same time. Animations of the same type cannot stack: calling MoveCameraTo multiple times in a row only honours the last call.

If you want the player back in control after the shot, hold the focus for a few seconds and then re-enable input. See Pause Input for the toggles.

This pattern is wired up in the Island City Builder scene. Hit Play and click the Important Event button on the canvas to see the camera fly to a configured target with the framing above.