What’s Mathf.abs for.

Asked

Viewed 40 times

-2

I am programming in Unity and I see many people using it, and sometimes I even use it in my scripts but I don’t understand exactly what it does "returns", please explain to me?

  • 2

    Absolute value (or module) of a number. https://docs.unity3d.com/ScriptReference/Mathf.Abs.html

1 answer

0

Returns the absolute value.

The absolute value of a Decimal is its numerical value without its sign

as in the example in the Unity documentation

    Debug.Log(Mathf.Abs(-10.5f));// prints 10.5
    Debug.Log(Mathf.Abs(-10));// prints 10

Browser other questions tagged

You are not signed in. Login or sign up in order to post.