Example - Minimap
You want to click on a minimap and have the camera fly to that spot in the world.
A minimap is just a UI element displaying the render of a top-down Camera aimed at your world. So the job is: convert the click's local position inside the UI into world XZ, then hand it to MoveCameraTo.
using UnityEngine;
using UnityEngine.EventSystems;
using Goehler.OrbitalCam;
public class MinimapClick : MonoBehaviour, IPointerClickHandler {
[SerializeField] private OrbitalCameraSystem _camera;
[SerializeField] private RectTransform _minimap;
[SerializeField] private Camera _minimapCamera;
public void OnPointerClick(PointerEventData eventData) {
RectTransformUtility.ScreenPointToLocalPointInRectangle(
_minimap,
eventData.position,
eventData.pressEventCamera,
out Vector2 local);
Rect rect = _minimap.rect;
float u = Mathf.InverseLerp(rect.xMin, rect.xMax, local.x);
float v = Mathf.InverseLerp(rect.yMin, rect.yMax, local.y);
Vector3 world = _minimapCamera.ViewportToWorldPoint(new Vector3(u, v, 0f));
_camera.MoveCameraTo(new Vector3(world.x, 0f, world.z), 0.5f);
}
}
Attach the script to the RawImage displaying the minimap (the parent Canvas needs a Graphic Raycaster for IPointerClickHandler to fire). Wire up the three references in the Inspector: the OrbitalCam, the RawImage's own RectTransform, and the top-down Camera rendering the minimap.
ViewportToWorldPoint does the XZ math for you using the minimap camera's transform and orthographic size. If you reposition or resize that camera, the click handler stays correct without any rewiring.
Scene setup: add a second Camera rotated (90, 0, 0) set to Orthographic, target a RenderTexture asset, and display that RenderTexture in a RawImage on your canvas. Drop the UI layer from the camera's culling mask so the minimap doesn't render itself recursively.
Note
The second argument to MoveCameraTo is the animation time in seconds. Drop it to use the default from the Speeds section, or raise it for a slower glide.
This pattern is wired up in the Island City Builder scene. Hit Play and click anywhere on the minimap.