Skip to content

Instantly share code, notes, and snippets.

@CapitanLiteral
Created July 1, 2019 16:08
Show Gist options
  • Save CapitanLiteral/286d9faeaa05ae7e5ffe4035366bb153 to your computer and use it in GitHub Desktop.
Save CapitanLiteral/286d9faeaa05ae7e5ffe4035366bb153 to your computer and use it in GitHub Desktop.
Vector3 diff = lookAt3dPosition - transform.position;
diff.Normalize();
float rot_z = Mathf.Atan2(diff.y, diff.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(0f, 0f, rot_z - 90);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment