Skip to content

Instantly share code, notes, and snippets.

@shiwano
Created July 15, 2015 10:19
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shiwano/0f236469cd2ce2f4f585 to your computer and use it in GitHub Desktop.
Save shiwano/0f236469cd2ce2f4f585 to your computer and use it in GitHub Desktop.
Getting 360 angle between two 3d vectors for Unity3D.
public static class Utility
{
public static float CalculateAngle(Vector3 from, Vector3 to)
{
return Quaternion.FromToRotation(Vector3.up, to - from).eulerAngles.z;
}
}
@cesarramirez23
Copy link

thanks

@Vlakdo
Copy link

Vlakdo commented Dec 3, 2019

thanks

@expoolleet
Copy link

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment