Lumberyard
Legacy Reference

# Math Nodes

 Flow Graph is deprecated and will be removed in a future version of Lumberyard. Learn about Script Canvas, Lumberyard's new visual scripting environment.

 This topic references tools and features that are legacy. If you want to use legacy tools in Lumberyard Editor, disable the CryEntity Removal gem using the Project Configurator or the command line. To learn about the latest features, see the Amazon Lumberyard User Guide.

You can use these flow graph nodes to define math operations.

Topics

## Abs node

Used to calculate the absolute value of the input.

Inputs

Port Type Description
Activate Any Triggers the node
A Float Input

Outputs

Port Type Description
Out Float Absolute value of the input

Used to add the two input values.

Inputs

Port Type Description
Activate Any Triggers the node
A Float First operand
B Float Second operand

Outputs

Port Type Description
Out Float Absolute value of the input

## AnglesToDir node

Used to convert the input angle to a unit vector direction.

Inputs

Port Type Description
Angles Vec3 Input angle

Outputs

Port Type Description
Dir Vec3 Direction unit vector
Roll Float Roll output

## ArcCos node

Used to calculate the inverse cosine of the input.

Inputs

Port Type Description
Activate Any Triggers the node
In Float Input angle

Outputs

Port Type Description
Activate Any Triggers the node
In Float Input angle

## ArcSin node

Used to calculate the inverse sine of the input.

Inputs

Port Type Description
Activate Any Triggers the node
In Float Input angle

Outputs

Port Type Description
Out Float Inverse sine (Arcsin) of the input

## ArcTan node

Used to calculate the inverse tangent of the input.

Inputs

Port Type Description
Activate Any Triggers the node
In Float Input angle

Outputs

Port Type Description
Out Float Inverse tangent (Arctan) of the input

## ArcTan2 node

Used to calculate the inverse tangent of the two inputs.

Inputs

Port Type Description
Activate Any Triggers the node
X Float X input value
Y Float Y input value

Outputs

Port Type Description
Out Float Inverse tangent (Arctan) of the Y and X inputs

## BooleanFrom node

Used to convert the Boolean input value (0 or 1) to true or false.

Inputs

Port Type Description
Value Boolean Boolean input (0 or 1)

Outputs

Port Type Description
False Float Triggers if input is false (0)
True Float Triggers if input is true (1)

## BooleanTo node

Used to convert the inputs to a Boolean 0 or 1 value.

Inputs

Port Type Description
True Float Will output true if event is received on this input
False Float Will output false if event is received on this input

Outputs

Port Type Description
Out Boolean Outputs true (1) or false (0) depending on input state

## Calculate node

Used to calculate the output value based on the operation performed on the two inputs.

Inputs

Port Type Description
Activate Any Activates the node
Operation Ingteger The mathematical operation to be performed
A Float First operand
B Float Second operand

Outputs

Port Type Description
Out Float Result of operation on A and B

## Ceil node

Used to output the ceiling value of the input.

Inputs

Port Type Description
In Float Input

Outputs

Port Type Description
Out Float Ceiling input value

## Clamp node

Used to clamp the output value to the Min and Max range.

Inputs

Port Type Description
In Float Input value
Min Float Minimum clamp value
Max Float Maximum clamp value

Outputs

Port Type Description
Out Float Triggered if the input is clamped within the range

## Cosine node

Used to output the cosine of the input.

Inputs

Port Type Description
Activate Any Triggers the node
In Float Input in degrees

Outputs

Port Type Description
Out Float Cosine of the input

## Counter node

Used to output the number of times the input has been activated.

Inputs

Port Type Description
In Any Input
Reset Any Resets the counter
Max Integer Maximum value of the counter before it is reset

Outputs

Port Type Description
Count Integer Number of times that the input was activated

## DirToAngles node

Used to convert the input vector direction to an angle.

Inputs

Port Type Description
Dir Vec3 Vector direction
Roll Float Roll input

Outputs

Port Type Description
Angles Vec3 Converts the direction to an angle in degrees

## Div node

Used to divide input A by input B.

Inputs

Port Type Description
Activate Any Triggers the node
A Float Dividend input
B Float Divisor input

Outputs

Port Type Description
Out Float Division of A by B

## Equal node

Used to check if the two inputs are equal in value.

Inputs

Port Type Description
Activate Any Triggers the node
A Float First operand
B Float Second operand

Outputs

Port Type Description
Out Boolean True if the two inputs are equal in value
OnTrue Any Triggered if the inputs are equal in value
OnFalse Any Triggered if the inputs are not equal in value

## EvenOrOdd node

Used to check if the input is an even or odd value.

Inputs

Port Type Description
In Integer Input

Outputs

Port Type Description
Odd Any Triggered if the input is an odd value
Even Any Triggered if the input is an even value

## Floor node

Used to output the floor of the input.

Inputs

Port Type Description
In Float Input

Outputs

Port Type Description
Out Float Floored input

## InRange node

Used to check if the input is within the Min and Max value range.

Inputs

Port Type Description
Activate Any Triggers the node
In Float Input
Min Float Minimum value of the range
Max Float maximum value of the range

Outputs

Port Type Description
Out Boolean True if the input is within the range
OnTrue Any Triggered if the input is within the range
OnFalse Any Triggered if the input is outside of the range

## Less node

Used to check whether the A input is less than the B input.

Inputs

Port Type Description
Out Boolean True if A is less than B
OnTrue Any Triggered is A is less then B
OnFalse Any Triggered if A is greater than B

Outputs

Port Type Description
Out Boolean True if A is less than B
OnTrue Any Triggered is A is less then B
OnFalse Any Triggered if A is greater than B

## Mod node

Used to calculate the modulus of the two inputs.

Inputs

Port Type Description
Activate Any Triggers the node
A Float First operand
B Float Second operand

Outputs

Port Type Description
Result Float Modulus of the two inputs

## Mul node

Used to multiply the two inputs.

Inputs

Port Type Description
Activate Any Triggers the node
A Float First operand
B Float Second operand

Outputs

Port Type Description
Out Float Multiplication of the two inputs

## Noise1D node

Used to multiply the scalar input by the frequency and amplitude.

Inputs

Port Type Description
X Float Scalar Input value to sample noise at
Frequency Float Frequency
Amplitude Float Amplitude

Outputs

Port Type Description
Out Float Multiplication of X by Frequency and Amplitude values

## Noise3D node

Used to multiple the vector input by the frequency and amplitude.

Inputs

Port Type Description
V Vec3 Vector input value to sample noise at
Frequency Float Frequency
Amplitude Float Amplitude

Outputs

Port Type Description
Out Float Multiplication of V by Frequency and Amplitude values

## PortCounter node

Used to count the number of activated inputs.

Inputs

Port Type Description
Reset Any Resets PortCount and TotalCount
PortThreshold Integer PortCount threshold value
TotalThreshold Integer TotalCount threshold value
In00 - In15 Any Inputs

Outputs

Port Type Description
PortCount Integer Number of ports that have been set
TotalCount Integer Sum of all times any of the input ports have been set
PortTrigger Boolean Triggered when PortCount reaches PortThreshold
TotalTrigger Boolean Triggered when TotalCount reaches TotalThreshold

## Power node

Used to calculate the Base input raised to the Power exponent.

Inputs

Port Type Description
Activate Any Triggers the node
Base Float Base input
Power Float Exponent input

Outputs

Port Type Description
Out Float Base input value raised to the Power exponent

## Random node

Used to generate a random number between the Min and Max values, both as an integer and as a floating point number.

Inputs

Port Type Description
Generate Any Generates a random number
Min Float Minimum value of the random number
Max Float Maximum value of the random number

Outputs

Port Type Description
Out Float Output as floating-point number
OutRounded Integer Output rounded to next integer value

## Reciprocal node

Used to output the reciprocal value of the input.

Inputs

Port Type Description
Activate Any Triggers the node
A Float Input

Outputs

Port Type Description
Out Float Reciprocal of the input

## Remainder node

Used to output the remainder value of A divided by B.

Inputs

Port Type Description
Activate Any Triggers the node
A Float Dividend input
B Float Divisor input

Outputs

Port Type Description
Out Float Remainder of the inputs

## Round node

Used to round the input floating point value to an integer output.

Inputs

Port Type Description
Activate Any Triggers the node
In Float Floating-point Input

Outputs

Port Type Description
OutRounded Integer Rounded integer value of the input

## SetColor node

Used to output the input vector color when the Set input is activated.

Inputs

Port Type Description
Set Any Triggers input to output
In Vec3 Vector input value

Outputs

Port Type Description
Out Vec3 Input value when Set is triggered

## SetNumber node

Used to output the input scalar number when the Set input is activated.

Inputs

Port Type Description
Activate Any Triggers the node
In Float Input

Outputs

Port Type Description
Out Float Outputs the input

## SinCos node

Used to calculate the sine and cosine of the input.

Inputs

Port Type Description
Activate Any Triggers the node
In Float Input angle in degrees

Outputs

Port Type Description
Sin Float Sine of the input
Cos Float Cosine of the input

## Sine node

Used to calculate the sine of the input.

Inputs

Port Type Description
Activate Any Triggers the node
In Float Input angle in degrees

Outputs

Port Type Description
Out Float Sine of the input

## Sqrt node

Used to calculate the square root of the input.

Inputs

Port Type Description
Activate Any Triggers the node
A Float Input

Outputs

Port Type Description
Out Float Square root of the input

## Sub node

Used to subtract the two inputs.

Inputs

Port Type Description
Activate Any Triggers the node
A Float First operand
B Float Second operand

Outputs

Port Type Description
Out Float Subtraction of the two inputs

## Tangent node

Used to calculate the tangent of the input.

Inputs

Port Type Description
Activate Any Triggers the node
In Float Input angle in degrees

Outputs

Port Type Description
Out Float Tangent of the inpt

## UpDownCounter node

Used to output an up or down counter.

Inputs

Port Type Description
Preset Integer Preset input value
Max Integer Maximum counter limit
Min Integer Minimum counter limit
Decrement Boolean Decrements the count
Increment Boolean Increments the count
Wrap Boolean If true, the counter will wrap

Outputs

Port Type Description
Out Float Current count