Math Expression Node

The math expression node allows you to type in a math expression and builds the appropriate sub-graph to create that expression.

Choose your operating system:




To create a Math Expression node, Right-click in the graph and select Add Math Expression... from the context menu.


The Math Expression node acts like a collapsed graph. It is a single node that you can Double-click to open the sub-graph that makes up its functionality. Initially, the name/expression is blank. Whenever you rename the node, then the new expression is parsed and a new sub-graph is generated.

To rename the node and update the sub-graph, Right-click on the node and select Rename.

For example, you could rename the Math Expression node with the following expression:


This would update the Math Expression node to have two float inputs, X and MyVar, and one float output.


If you Double-click the node with this expression, you would see the below sub-graph:


The sub-graph is created by following the below rules:

  1. Alphabetic names (tokens beginning with a letter) should be turned into either variables, input pins on the Math Expression node, or function calls. From the example above: x, sin, myVar, and rand.

    1. If an alphabetic name matches an existing variable in the Blueprint, then it will become a variable get node (i.e. if the Blueprint already had a myVar variable).

    2. If an alphabetic name is followed by an open parenthesis, like sin( and rand(, then it will be turned into a function node.

    3. If the previous two states are not met, then the alphabetic name is turned into a float input on the Math Expression node.

    4. The name will also be used as an input if it matches the name of an existing pin on the node.

  2. Numerical constants are always turned into pin inputs. They never create a node themselves, but instead are used to fill out input fields on other nodes.

  3. Mathematical operators (like +, *, -) are turned into function nodes.

  4. Like in mathematics, expressions inside of parentheses will take precedence, and be evaluated first.


Variable naming is fairly flexible, but it is important to remember the following points:

  • Variables can have numbers in them, but they cannot start with a number.

  • Variables cannot have the same name as a hidden Blueprint variable.

  • Be sure that you are working with the correct type of variable. For example, boolVar+1.5 is not a valid expression.

Order of Operations

Operations follow the below order of operations (highest priority first):

  1. Parentheses

  2. Factorials

  3. Exponents

  4. Multiplication and division

  5. Addition and subtraction

Available Blueprint Functions

Blueprint pure functions that are in a coded function library should all be available. These include:

  • Trig functions (sin/cos/tan, asin, acos, etc.):

  • Clamping functions (min, max, clamp, etc.):

  • Rounding functions (floor, fceil, round, etc.):

  • Exponential functions (square, power, sqrt, loge, e/exp, etc.)

Certain functions have multiple names that are commonly used. To account for that, there are several aliases that map to the same function/node. Some examples are:

  • Power aliases: power, pow

  • Trig arc functions (asin/arcsin, acos/arccos, etc.)

Since you are typing in functions rather than connecting pins, make sure to enter the correct number and type of parameters. The Math Expression node will display an error if there is a mismatch.

Basic Struct Types

There are some basic structures that we use quite often in math as well: vectors, transforms, etc. You can make and operate on these types in the expression easily.

  • The vector keyword spawns a MakeVector node:

  • The rotator keyword spawns a MakeRotator node:

  • The transform keyword spawns a MakeTransform node:

    transform(vec(x,y,z), rot(p,y,r), vec(6,5,4))

Just like there are aliases for certain functions, there are vector and rotator aliases.

  • Vector aliases

    vector, vec, vect
  • Rotator aliases

    rotator, rot

Supported Operators

The following operators should all be supported, and the logical and comparison operators can be combined to create complex expressions.

  • Multiplicative:

    *, /, %
  • Additive:

    +, -
  • Relational:

    <, >, <=, >=
  • Equality:

    ==, !=
  • Logical:

    ||, &&, ^

Unsupported Operators

Currently, the following operators are unsupported.

  • Conditional:

  • Bitwise:

    |, &, <<, >>
  • Unary prefix:

    +, -, ++, --, ~, !, etc.
  • Postfix:

    ++, --, [], etc.
Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey