Skip to content

Instantly share code, notes, and snippets.

@sylistine
Last active February 8, 2016 09:16
Show Gist options
  • Save sylistine/c8a845f6c4f07f192720 to your computer and use it in GitHub Desktop.
Save sylistine/c8a845f6c4f07f192720 to your computer and use it in GitHub Desktop.
Vector3 currentCameraPosition = cam.transform.position - (this.transform.position + lookOffset);
Vector3 currentCameraPositionXZ = new Vector3(relativeCameraPosition.x, 0, relativeCameraPosition.z);
float currentCameraPitch = Mathf.Atan2(currentCameraPosition.y, currentCameraPositionXZ.magnitude) * Mathf.Rad2Deg;
if (currentCameraPitch > maxCameraPitch)
{
// This camera is too damn high!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment