Content-Length: 19947 | pFad | https://docs.unity3d.com/ScriptReference/../Manual/../ScriptReference/Mathf.Sign.html
| Parameter | Description |
|---|---|
| f | Real number whose sign will be retrieved. |
float
Mathematical sign of f.
Returns the mathematical sign of f.
Returns either a value of -1 when f is negative, or a value of 1 when f is 0 or greater. This is different from standard 'Sign' implementations which return 0 whenever f equals 0.
using UnityEngine;
public class Example : MonoBehaviour { void Start() { // Prints -1 Debug.Log(Mathf.Sign(-10)); // Prints 1 Debug.Log(Mathf.Sign(0)); // Prints 1 Debug.Log(Mathf.Sign(10)); } }
Fetched URL: https://docs.unity3d.com/ScriptReference/../Manual/../ScriptReference/Mathf.Sign.html
Alternative Proxies: