Parameter | Description |
---|---|
f | Value to compute the arc-tangent for, in the range [-Infinity, Infinity]. |
float
Angle in radians whose tangent equals f
, in the range [-Pi/2, Pi/2].
Returns the arc-tangent of f
- the angle in radians whose tangent is f
.
For values of f
outside of the [-1,1] range, this function will return NaN.
Additional resources: Tan, Atan2.
using UnityEngine;
public class ScriptExample : MonoBehaviour { void Start() { // Prints -1.570796 Debug.Log(Mathf.Atan(-Mathf.Infinity)); // Prints -0.7853982 Debug.Log(Mathf.Atan(-1)); // Prints 0 Debug.Log(Mathf.Atan(0)); // Prints 0.7853982 Debug.Log(Mathf.Atan(1)); // Prints 1.570796 Debug.Log(Mathf.Atan(Mathf.Infinity)); } }