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