World Utilities / Converters
Int Math
Adds, subtracts, multiplies, divides or takes the remainder of two int inputs.
since v0.7.0localsynchronizedpersisted
| Component | Add Component menu / prefab | Source |
|---|---|---|
Int Math ConverterVRCTools.World.Values.Converters.IntMathConverter
|
Values › Converters › Int Math Converter
|
IntMathConverter.cs ↗ |
The integer counterpart of Float Math. Computes
A <operation> B whenever A or B change.
Operations
| Operation | Result | Notes |
|---|---|---|
ADD |
A + B |
|
SUBTRACT |
A - B |
|
MULTIPLY |
A * B |
|
DIVIDE |
A / B |
Integer division, rounds towards zero (7 / 2 = 3). |
REM |
A % B |
Remainder of the division (7 % 2 = 1), sign follows A. |
Parameters
| Section | Parameter | Default | Description |
|---|---|---|---|
| Target | Type | LOCAL |
Kind of the target value. |
| Target | None | Int value receiving the result. Required. | |
| Math | Operation | ADD |
The operation to perform. |
| A | Type | STATIC |
STATIC, LOCAL or SYNCHRONIZED. |
| Value | 1 |
The constant (static) or int value providing A. | |
| B | Type | STATIC |
STATIC, LOCAL or SYNCHRONIZED. |
| Value | 1 |
The constant (static) or int value providing B. |
Integer division or remainder by zero throws an exception, which halts the Udon behaviour. Never let B reach zero for
DIVIDEandREM- restrict the source value’s minimum to1.
Usage
REM is great for cycling: feed a counter that is incremented by a “next” button into REM with a static B of 5
and the result loops through 0, 1, 2, 3, 4, 0, ... - ready to select one of five options.