Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Atan(float)

Returns the arc-tangent of f - the angle in radians whose tangent is f.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public static float Atan(float f)

Parameters

Value to compute the arc-tangent for, in the range [-Infinity, Infinity].

Returns

Type

Description

floatAngle in radians whose tangent equals
f
, in the range [-Pi/2, Pi/2].

Remarks

For values of
f
outside of the [-1,1] range, this function will return NaN.
Additional Resources: Mathf.Tan, Mathf.Atan2.

Examples

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)); }}