Skip to main content

Max

This node returns the larger of two numbers.

The Max node compares two values and outputs the maximum.

The Max node takes two numeric inputs and simply outputs whichever one is larger. It is useful for setting a floor for values (e.g., ensuring a value doesn't drop below zero).

Inputs

Numbers

DataDescription
First NumberThe first number to compare. Default: 0.
Second NumberThe second number to compare. Default: 0.

Actions

SignalDescription
DoTriggers the comparison. The result is updated only when this signal is received.

Outputs

Data

DataDescription
ResultThe larger of the two input numbers.

Signals

SignalDescription
DoneTriggered when the calculation is successfully completed.

Usage

Example Use Cases

  1. Flooring a Value (Clamping Bottom): Ensure a value doesn't go below a limit.
    • First Number: Calculated Damage (e.g., -5 due to high armor).
    • Second Number: Min Damage (e.g., 0).
    • Result: 0 (Damage cannot be negative).
  2. High Score: Comparing current score with stored high score.
  3. Layout: Determining the widest element in a group to set container width.

Detailed Behavior

  1. Validation: Inputs must be valid numbers within ±1,000,000,000,000.
  2. Calculation: Uses Math.max().
  3. Trigger: Only updates on Do.

Troubleshooting

  • Confusing Name: "Max" is often used to limit a value from going lower (setting a floor). To limit a value from going higher, use Min.