Skip to content

Instantly share code, notes, and snippets.

@jweimann
Created November 20, 2016 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jweimann/19e43c0fe801c8d38b253586c33ec7ab to your computer and use it in GitHub Desktop.
Save jweimann/19e43c0fe801c8d38b253586c33ec7ab to your computer and use it in GitHub Desktop.
public static void LookAtY(this Transform transform, Vector3 point)
{
var lookPos = point - transform.position;
lookPos.y = 0;
var rotation = Quaternion.LookRotation(lookPos);
transform.rotation = rotation;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment