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).
Numbers
| Data | Description |
|---|
| First Number | The first number to compare. Default: 0. |
| Second Number | The second number to compare. Default: 0. |
Actions
| Signal | Description |
|---|
| Do | Triggers the comparison. The result is updated only when this signal is received. |
Outputs
Data
| Data | Description |
|---|
| Result | The larger of the two input numbers. |
Signals
| Signal | Description |
|---|
| Done | Triggered when the calculation is successfully completed. |
Usage
Example Use Cases
- 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).
- High Score: Comparing current score with stored high score.
- Layout: Determining the widest element in a group to set container width.
Detailed Behavior
- Validation: Inputs must be valid numbers within ±1,000,000,000,000.
- Calculation: Uses
Math.max().
- 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.