Acos(float)
Returns the arc-cosine of f - the angle in radians whose cosine is f.
Read time 1 minuteLast updated 5 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public static float Acos(float f)
Parameters
Value to compute the arc-cosine for, in the range [-1,1].
Returns
Type | Description |
|---|---|
| float | Angle in radians whose cosine equals |
Remarks
For values of outside of the [-1,1] range, this function will return NaN.
fAdditional Resources: Mathf.Cos.
Examples
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)); }}