Skip to content

Transform Look At Mouse 2D

Rotates a Transform in 2D so a chosen local axis faces the mouse cursor.

Parameters

Parameter Description
Transform The Transform to rotate.
Camera Camera used to project the mouse into world space.
Facing Axis 2D local axis that should face the mouse.
Smooth Time Smoothing time in seconds.
Max Speed Maximum turn speed in degrees per second.

Notes

  • This is useful for twin-stick style aiming, top-down shooters, and cursor-driven facing.