Overview
Produces one true / false value from a short expression. Instead of arranging
compare and logical-operation nodes, write a compound condition in one
expression, such as flag || x > 0.5. Send the result to a switch or gate
condition.
Usage tips
- Keep a simple comparison that needs only one
compareas a node. Once two or more conditions interact, consolidating them here makes the graph easier to read. - Because
time/frameare available, one expression can describe temporal conditions such as "true only on certain frames" (for example,frame % 4 == 0). - This also works as a test bench for a
list_filterpredicate because it uses the same expression syntax.
Related nodes
compare/value_match— use nodes for simple decisionsswitch/gate— destinations for the Bool valueexpression_float/expression_vec2— other types using the same expression enginelist_filter— list-based conditional expressions
Read this first
- The
x,y,vec, andflagnames here are separate from variables created in the Variables panel. - They are the input pin names of the Expression node itself.
- You can also enter
x,y,vec_x,vec_y, andflagdirectly in the Inspector. - To use a variable from the Variables panel, retrieve it with
Variable Refor a similar node and connect it to the relevant input pin. - When a value is connected to an input pin, the input-pin value takes precedence over the Inspector value.
- Unconnected inputs use the following values:
x,y=0vec=[vec_x, vec_y]flag=false
Available features
- Variables:
x,y,vec,vx,vy,flag,time,frame,total_frames - Operators:
+ - * / %,== != < <= > >=,&& || ! - Functions:
min,max,clamp,abs,floor,ceil,round,sign,sin,cos,tan,sqrt,pow,lerp,vec2,x,y,length,if
Common expressions
x < 0.5flag || x > 0.5length(vec) >= 4
Concrete examples
Example 1: Threshold test
- Set
xto0.25 expression = x < 0.5
value = true
Example 2: Compound condition
- Set
flagtofalse - Set
xto0.8 expression = flag || x > 0.5
value = true
When to use it
- When you want to produce a Bool for a
Switchor filter condition with only a lightweight expression - When you want to test a
List Filterpredicate on its own first
Notes
&&/||skip the right side once the result is known.if(condition, A, B)evaluates only the selected branch, so an error in the unselected branch does not affect the result.- Numeric rules match the Math nodes: reversed
clampbounds are swapped,sign(0) = 0, and%is a non-negative Euclidean remainder. Division or modulo by zero andsqrtof a negative value produce an error. - Values other than Bool can be evaluated, but the final result is converted to true / false.
- This is not intended for writing complex state machines.
- While you type an expression, the incomplete intermediate text is evaluated immediately, so an error may appear temporarily.