MathF

Abs

Outputs the absolute, i.e. non-negative, value of A.

Inputs:

Name
Type
Description

A

Float or Int

The initial value.

Outputs:

Name
Type
Description

Output

Float or Int

If A is positive, the output is A. If A is negative, the output is 0-A. The type of the output matches the input.

Approximately

Compares two floating point values and outputs true if they're very close in value.

Floating point operations can introduce a very small level of imprecision. You can use this node to make allowance for that imprecision. For more information, refer to Mathf.Approximately in the Unity documentation.

Inputs:

Name
Type
Description

A

Float [editable]

The first number to compare.

B

Float [editable]

The second number to compare.

Outputs:

Name
Type
Description

Output

Boolean

True if A is equal to B ± the smallest value that can be represented by a floating point number.

Clamp

Applies restrictions to a value so that it remains within a set range.

Inputs:

Name
Type
Description

Value

Float or Int

The value to clamp.

Min

Float or Int

The maximum allowed value.

Max

Float or Int

The minimum allowed value.

Outputs:

Name
Type
Description

Output

Float or Int

If Value is between Min and Max, returns Value. If Value is less than Min, returns Min. If Value is greater than Max, returns Max. The type of the output matches the input.

Cos

Applies the cosine trigonometric function.

Inputs:

Name
Type
Description

Input

Float [editable]

Angle in radians.

Outputs:

Name
Type
Description

Output

Float

The cosine of the input angle.

Lerp

Outputs a linear interpolation between two input values. For example, if T=0.5, the output is a value half way between A and B.

Inputs:

Name
Type
Description

A

Float [editable]

The start value.

B

Float [editable]

The end value.

T

Float [editable]

The interpolation value between A and B. In a range between 0 and 1.0.

Outputs:

Name
Type
Description

Output

Float

The interpolated value between A and B.

Lerp Angle

Outputs a linear interpolation between two input angles. For example, if T=0.5, the output is an angle half way between A and B.

Inputs:

Name
Type
Description

A

Float [editable]

The start angle, in degrees.

B

Float [editable]

The end angle, in degrees.

T

Float [editable]

The interpolation value between A and B. In a range between 0 and 1.0.

Outputs:

Name
Type
Description

Output

Float

The interpolated value between A and B.

Max

Outputs the largest of the input values.

Inputs:

Name
Type
Description

A

Float or Int

A value to compare.

B

Float or Int

A value to compare.

Outputs:

Name
Type
Description

Output

Float or Int

The largest of A and B.

Min

Outputs the smallest of the input values.

Inputs:

Name
Type
Description

A

Float or Int

A value to compare.

B

Float or Int

A value to compare.

Outputs:

Name
Type
Description

Output

Float or Int

The smallest of A and B.

Move Towards

Moves a current value towards a target value. The change to Current will not exceed Max Delta.

If you set Max Delta to a negative value, the current value is moved away from the target value.

Inputs:

Name
Type
Description

Current

Float [editable]

The current value.

Target

Float [editable]

The value to move towards.

Max Delta

Float [editable]

The maximum change applied to the current value.

Outputs:

Name
Type
Description

Output

Float

An adjusted value of Current that's advanced towards Target. In most cases, Output = Current + Max Delta.

Move Towards Angle

Moves a current angle towards a target angle. The change to Current will not exceed Max Delta.

Inputs:

Name
Type
Description

Current

Float [editable]

The current angle.

Target

Float [editable]

The angle to move towards.

Max Delta

Float [editable]

The maximum change applied to the current angle.

Outputs:

Name
Type
Description

Output

Float

An adjusted value of Current that's advanced towards Target. In most cases, Output = Current + Max Delta.

Sign

Outputs an number that indicates whether the input is positive or negative.

Inputs:

Name
Type
Description

Input

Float [editable]

The number to evaluate.

Outputs:

Name
Type
Description

Output

Float

If Input >= 0, the output is 1. If Input < 0, the output is -1.

Sin

Applies the sine trigonometric function.

Inputs:

Name
Type
Description

Input

Float [editable]

Angle in radians.

Outputs:

Name
Type
Description

Output

Float

The sine of the input angle.

Smooth Damp

Gradually moves the current value towards a target value, over a specified time. For more information, refer to Mathf.SmoothDamp in the Unity documentation.

Inputs:

Name
Type
Description

Current

Float [editable]

The current value.

Target

Float [editable]

The target value.

Smooth Time

Float [editable]

The approximate time it takes for the current value to reach the target value.

Outputs:

Name
Type
Description

Output

Float

The adjusted value.

Current Velocity

Float

The calculated increment that will advance the Current value to the Target value in the specified Smooth Time.

Smooth Damp Angle

Gradually changes an angle given in degrees towards a desired goal angle over time. For more information, refer to Mathf.SmoothDampAngle in the Unity documentation.

Inputs:

Name
Type
Description

Current

Float [editable]

The current angle.

Target

Float [editable]

The target angle.

Smooth Time

Float [editable]

The approximate time it takes for the current angle to reach the target angle.

Outputs:

Name
Type
Description

Output

Float

The adjusted angle.

Current Velocity

Float

The calculated increment that will advance the Current angle to the Target angle in the specified Smooth Time.

Smooth Step

Interpolates between From and To with smoothing at the limits. The interpolation will gradually speed up from the start and slow down toward the end.

Inputs:

Name
Type
Description

From

Float [editable]

Start value.

To

Float [editable]

End value.

T

Float [editable]

The interpolation value between From and To. In a range between 0 and 1.0.

Outputs:

Name
Type
Description

Output

Float

The interpolated value between From and To.

Tan

Applies the tangent trigonometric function.

Inputs:

Name
Type
Description

Input

Float [editable]

Angle in radians.

Outputs:

Name
Type
Description

Output

Float

The tangent of the input angle.

Last updated