Skip to content

Math Blueprint Nodes

This document describes the blueprint nodes provided by the @esengine/ecs-framework-math module.

Note: These nodes require the math module to be installed.

Float
Vector2
Fixed32
FixedVector2
Color

2D vector operations for position, velocity, and direction calculations.

NodeDescriptionInputsOutput
Make Vector2Create Vector2 from X, YX, YVector2
Break Vector2Decompose Vector2 to X, YVectorX, Y
Vector2 +Vector additionA, BVector2
Vector2 -Vector subtractionA, BVector2
Vector2 *Vector scalingVector, ScalarVector2
Vector2 LengthGet vector lengthVectorFloat
Vector2 NormalizeNormalize to unit vectorVectorVector2
Vector2 DotDot productA, BFloat
Vector2 Cross2D cross productA, BFloat
Vector2 DistanceDistance between two pointsA, BFloat
Vector2 LerpLinear interpolationA, B, TVector2
Vector2 RotateRotate by angle (radians)Vector, AngleVector2
Vector2 From AngleCreate unit vector from angleAngleVector2

Direction vector from start to end point:

Make Vector2
X 0
Y 0
Vector
Make Vector2
X 100
Y 50
Vector
Vector2 -
A
B
Result
Vector2 Normalize
Vector
Result

Calculate circular position using angle and radius:

Vector2 From Angle
Angle 1.57
Vector
Vector2 *
Vector
Scalar 50
Result
Vector2 +
A (Center)
B
Position

Q16.16 fixed-point number operations for lockstep networking games, ensuring cross-platform calculation consistency.

NodeDescriptionInputsOutput
Fixed32 From FloatCreate from floatFloatFixed32
Fixed32 From IntCreate from integerIntFixed32
Fixed32 To FloatConvert to floatFixed32Float
Fixed32 To IntConvert to integerFixed32Int
Fixed32 +AdditionA, BFixed32
Fixed32 -SubtractionA, BFixed32
Fixed32 *MultiplicationA, BFixed32
Fixed32 /DivisionA, BFixed32
Fixed32 AbsAbsolute valueValueFixed32
Fixed32 SqrtSquare rootValueFixed32
Fixed32 FloorFloorValueFixed32
Fixed32 CeilCeilingValueFixed32
Fixed32 RoundRoundValueFixed32
Fixed32 SignSign (-1, 0, 1)ValueFixed32
Fixed32 MinMinimumA, BFixed32
Fixed32 MaxMaximumA, BFixed32
Fixed32 ClampClamp to rangeValue, Min, MaxFixed32
Fixed32 LerpLinear interpolationA, B, TFixed32

Example: Lockstep Movement Speed Calculation

Section titled “Example: Lockstep Movement Speed Calculation”
Fixed32 From Float
Value 5.0
Speed
Fixed32 From Float
Value 0.016
DeltaTime
Fixed32 *
A
B
Result
Fixed32 To Float
Fixed
Float

Fixed-point vector operations for deterministic physics calculations, suitable for lockstep networking.

NodeDescriptionInputsOutput
Make FixedVector2Create from X, Y floatsX, YFixedVector2
Break FixedVector2Decompose to X, Y floatsVectorX, Y
FixedVector2 +Vector additionA, BFixedVector2
FixedVector2 -Vector subtractionA, BFixedVector2
FixedVector2 *Scale by Fixed32Vector, ScalarFixedVector2
FixedVector2 NegateNegate vectorVectorFixedVector2
FixedVector2 LengthGet lengthVectorFixed32
FixedVector2 NormalizeNormalizeVectorFixedVector2
FixedVector2 DotDot productA, BFixed32
FixedVector2 Cross2D cross productA, BFixed32
FixedVector2 DistanceDistance between pointsA, BFixed32
FixedVector2 LerpLinear interpolationA, B, TFixedVector2
Make FixedVector2
X 10
Y 20
Position
Make FixedVector2
X 1
Y 0
Velocity
FixedVector2 +
A
B
New Position

Color creation and manipulation nodes.

NodeDescriptionInputsOutput
Make ColorCreate from RGBAR, G, B, AColor
Break ColorDecompose to RGBAColorR, G, B, A
Color From HexCreate from hex stringHexColor
Color To HexConvert to hex stringColorString
Color From HSLCreate from HSLH, S, LColor
Color To HSLConvert to HSLColorH, S, L
Color LerpColor interpolationA, B, TColor
Color LightenLightenColor, AmountColor
Color DarkenDarkenColor, AmountColor
Color SaturateIncrease saturationColor, AmountColor
Color DesaturateDecrease saturationColor, AmountColor
Color InvertInvertColorColor
Color GrayscaleConvert to grayscaleColorColor
Color LuminanceGet luminanceColorFloat
NodeValue
Color White(1, 1, 1, 1)
Color Black(0, 0, 0, 1)
Color Red(1, 0, 0, 1)
Color Green(0, 1, 0, 1)
Color Blue(0, 0, 1, 1)
Color Transparent(0, 0, 0, 0)
Color Red
Color
Color Blue
Color
Color Lerp
A
B
T 0.5
Result
Color From Hex
Hex "#FF5722"
Color
Break Color
Color
R
G
B
A