lookAt method

void lookAt(
  1. Vector2 target
)

Rotates/snaps the component to look at the target.

This method sets the angle so that the component's orientation vector (as determined by the nativeAngle) is pointing at the target. target should to be in absolute/world coordinate system.

See also: angleTo

Implementation

void lookAt(Vector2 target) => angle += angleTo(target);