Skip to content

Vector actions

33 actions in the Vector category. Each block mirrors how the action appears in the editor's sidebar.

Drop Height

Every Frame
Drop Height Vector
(0.0, 0.0, 0.0)

Drops the height of a 3D vector, leaving only its ground-plane part. Useful for measuring horizontal movement or facing without the vertical component.

Input Type Default Description
Vector Vector3 (0.0, 0.0, 0.0) The vector to flatten onto the ground plane.
Output Type Description
Result Vector3 The vector with its Y set to zero.

Phases StartEvery FramePhysicsEnd

Get Vector2 XY

Every Frame
Get Vector2 XY Vector
(0.0, 0.0)

Splits a Vector2 into its separate X and Y numbers.

Input Type Default Description
Vector Vector2 (0.0, 0.0) The vector to split.
Output Type Description
X float The horizontal component.
Y float The vertical component.

Phases StartEvery FramePhysicsEnd

Get Vector3 XYZ

Every Frame
Get Vector3 XYZ Vector
(0.0, 0.0, 0.0)

Splits a Vector3 into its separate X, Y and Z numbers.

Input Type Default Description
Vector Vector3 (0.0, 0.0, 0.0) The vector to split.
Output Type Description
X float The value along the x axis.
Y float The value along the y axis.
Z float The value along the z axis.

Phases StartEvery FramePhysicsEnd

Ground Speed

Every Frame
Ground Speed Vector
(0.0, 0.0, 0.0)

Measures the length of a 3D vector on the ground plane, ignoring its height. Feeding a velocity gives ground speed; feeding an offset gives flat distance.

Input Type Default Description
Vector Vector3 (0.0, 0.0, 0.0) The vector to measure on the ground plane.
Output Type Description
Result float The ground-plane length of the vector.

Phases StartEvery FramePhysicsEnd

Make Vector2

Every Frame
Make Vector2 Vector
X 0.0 | Y 0.0

Builds a Vector2 from separate X and Y numbers.

Input Type Default Description
X float 0.0 The horizontal component.
Y float 0.0 The vertical component.
Output Type Description
Result Vector2 The built vector.

Phases StartEvery FramePhysicsEnd

Make Vector3

Every Frame
Make Vector3 Vector
X 0.0 | Y 0.0 | Z 0.0

Builds a Vector3 from separate X, Y and Z numbers.

Input Type Default Description
X float 0.0 The value along the x axis.
Y float 0.0 The value along the y axis.
Z float 0.0 The value along the z axis.
Output Type Description
Result Vector3 The built vector.

Phases StartEvery FramePhysicsEnd

Random Direction

Every Frame
Random Direction Vector
Min Angle 0.0 | Max Angle 360.0 | Length 1.0

Picks a random direction as a Vector2, with its angle chosen between Min Angle and Max Angle. In degrees, 0 points right and 90 points down.

Input Type Default Description
Min Angle float 0.0 The smallest angle to pick, in degrees.
Max Angle float 360.0 The largest angle to pick, in degrees.
Length float 1.0 How long the resulting vector is, in pixels.
Output Type Description
Result Vector2 The random direction vector.

Phases StartEvery FramePhysicsEnd

Random Point In Radius

Every Frame
Random Point In Radius Vector
Center not set | Radius 100.0

Picks a random point around a center, never farther than Radius. It picks inside a circle on a 2D script and inside a sphere on a 3D one.

Input Type Default Description
Center Variant - The point to pick around, such as the position of a node.
Radius float 100.0 How far from the center the point can land, in pixels for 2D and in units for 3D.
Output Type Description
Result Variant Where to store the point, a Vector2 in 2D and a Vector3 in 3D.

Phases StartEvery FramePhysicsEnd

Random Vector2

Every Frame
Random Vector2 Vector
Min (0.0, 0.0) | Max (100.0, 100.0)

Picks a random point inside the rectangle between Min and Max.

Input Type Default Description
Min Vector2 (0.0, 0.0) The top-left corner of the area.
Max Vector2 (100.0, 100.0) The bottom-right corner of the area.
Output Type Description
Result Vector2 The random point.

Phases StartEvery FramePhysicsEnd

Random Vector3

Every Frame
Random Vector3 Vector
Min (0.0, 0.0, 0.0) | Max (10.0, 10.0, 10.0)

Picks a random point inside the box between Min and Max, useful to spawn something at a random spot.

Input Type Default Description
Min Vector3 (0.0, 0.0, 0.0) The lowest corner of the box.
Max Vector3 (10.0, 10.0, 10.0) The highest corner of the box.
Output Type Description
Result Vector3 The random point.

Phases StartEvery FramePhysicsEnd

Scale Vector2

Every Frame
Scale Vector2 Vector
Vector (0.0, 0.0) | Factor 1.0

Multiplies a vector by a single number, keeping its direction and changing its length. It is how a direction becomes a speed.

Input Type Default Description
Vector Vector2 (0.0, 0.0) The vector to grow or shrink.
Factor float 1.0 How much to multiply it by. Below 1 shrinks it, and a negative number flips it.
Output Type Description
Result Vector2 The scaled vector.

Phases StartEvery FramePhysicsEnd

Scale Vector3

Every Frame
Scale Vector3 Vector
Vector (0.0, 0.0, 0.0) | Factor 1.0

Multiplies a vector by a single number, keeping its direction and changing its length. It is how a direction becomes a speed.

Input Type Default Description
Vector Vector3 (0.0, 0.0, 0.0) The vector to grow or shrink.
Factor float 1.0 How much to multiply it by. Below 1 shrinks it, and a negative number flips it.
Output Type Description
Result Vector3 The scaled vector.

Phases StartEvery FramePhysicsEnd

Vector2 Bounce

Every Frame
Vector2 Bounce Vector
Vector (0.0, 0.0) | Normal (0.0, 1.0)

Turns a velocity into the one it keeps after bouncing off a surface, the way a ball comes off a wall. Cast Ray and Move And Collide already report the Normal it needs on a hit.

Input Type Default Description
Vector Vector2 (0.0, 0.0) The incoming vector, such as a velocity.
Normal Vector2 (0.0, 1.0) The direction the surface faces, straight out of it. A collision reports it as the normal.
Output Type Description
Result Vector2 The bounced vector.

Phases StartEvery FramePhysicsEnd

Vector2 Combine

Every Frame
Vector2 Combine Vector
Function 'distance_to' | A (0.0, 0.0) | B (0.0, 0.0)

Turns two vectors into one number, such as how far apart two points are or the angle between them.

Input Type Default Description
Function String 'distance_to' distance_to is how far apart they are, dot tells how much they point the same way, and the angle ones give the angle between them.
A Vector2 (0.0, 0.0) The first vector.
B Vector2 (0.0, 0.0) The second vector.
Output Type Description
Result float The resulting number. The angle functions answer in degrees.

Phases StartEvery FramePhysicsEnd

Vector2 Direction To

Every Frame
Vector2 Direction To Vector
From (0.0, 0.0) | To (0.0, 0.0)

Gives the direction that points from one place to another, always exactly one unit long so it carries no speed of its own. Multiply it with Scale Vector2 to turn it into a velocity, such as sending a bullet toward the player.

Input Type Default Description
From Vector2 (0.0, 0.0) The starting point.
To Vector2 (0.0, 0.0) The point to aim at.
Output Type Description
Result Vector2 The direction from From to To, one unit long.

Phases StartEvery FramePhysicsEnd

Vector2 Info

Every Frame
Vector2 Info Vector
Function 'length' | Vector (0.0, 0.0)

Reads one number out of a vector: how long it is, or which way it points. Feeding a velocity to length gives the current speed.

Input Type Default Description
Function String 'length' length is how long it is, angle is the direction in degrees, and length_squared skips the square root, good enough to compare two distances.
Vector Vector2 (0.0, 0.0) The vector to read.
Output Type Description
Result float The resulting number.

Phases StartEvery FramePhysicsEnd

Vector2 Lerp

Every Frame
Vector2 Lerp Vector
From (0.0, 0.0) | To (0.0, 0.0) | Weight 0.5

Blends two 2D vectors by a weight and stores the result. Weight 0 is the first, 1 is the second.

Input Type Default Description
From Vector2 (0.0, 0.0) The value at weight 0.
To Vector2 (0.0, 0.0) The value at weight 1.
Weight float 0.5 How far from the first to the second, 0 to 1.
Output Type Description
Result Vector2 The blended vector.

Phases StartEvery FramePhysicsEnd

Vector2 Limit Length

Every Frame
Vector2 Limit Length Vector
Vector (0.0, 0.0) | Max 1.0

Shortens a vector when it is longer than Max, and leaves it alone when it is not. Capping a velocity is what stops diagonal movement from being faster than walking straight.

Input Type Default Description
Vector Vector2 (0.0, 0.0) The vector to cap.
Max float 1.0 The longest the vector may be.
Output Type Description
Result Vector2 The capped vector.

Phases StartEvery FramePhysicsEnd

Vector2 Math

Every Frame
Vector2 Math Vector
A (0.0, 0.0) | Operator '+' | B (0.0, 0.0)

Combines two vectors with an arithmetic operator, such as add or multiply. Adding is how a position gets offset.

Input Type Default Description
A Vector2 (0.0, 0.0) The left-hand vector.
Operator String '+' The arithmetic operation to apply.
B Vector2 (0.0, 0.0) The right-hand vector.
Output Type Description
Result Vector2 The resulting vector.

Phases StartEvery FramePhysicsEnd

Vector2 Rotated

Every Frame
Vector2 Rotated Vector
Vector (1.0, 0.0) | Angle 0.0

Rotates a vector by an angle and returns the turned vector.

Input Type Default Description
Vector Vector2 (1.0, 0.0) The vector to rotate.
Angle float 0.0 How far to turn it, in degrees.
Output Type Description
Result Vector2 The rotated vector.

Phases StartEvery FramePhysicsEnd

Vector2 To Vector3

Every Frame
Vector2 To Vector3 Vector
Vector (0.0, 0.0) | Height 0.0

Turns a flat direction into a 3D one lying on the ground, so a 2D input drives movement in a 3D world. The Y of the vector becomes the Z of the result.

Input Type Default Description
Vector Vector2 (0.0, 0.0) The flat direction, such as the one a movement input gives.
Height float 0.0 The value the Y of the result takes.
Output Type Description
Result Vector3 The direction on the ground plane.

Phases StartEvery FramePhysicsEnd

Vector2 Transform

Every Frame
Vector2 Transform Vector
Function 'normalized' | Vector (0.0, 0.0)

Reshapes a vector and stores the new one, most often to normalize it: keep the direction but set the length to 1, so it stops carrying a speed.

Input Type Default Description
Function String 'normalized' normalized keeps the direction and sets the length to 1, abs drops the minus signs, floor, ceil and round snap to whole numbers, and orthogonal turns it a quarter turn.
Vector Vector2 (0.0, 0.0) The vector to transform.
Output Type Description
Result Vector2 The resulting vector.

Phases StartEvery FramePhysicsEnd

Vector3 Bounce

Every Frame
Vector3 Bounce Vector
Vector (0.0, 0.0, 0.0) | Normal (0.0, 1.0, 0.0)

Turns a velocity into the one it keeps after bouncing off a surface, the way a ball comes off a wall. Cast Ray and Move And Collide already report the Normal it needs on a hit.

Input Type Default Description
Vector Vector3 (0.0, 0.0, 0.0) The incoming vector, such as a velocity.
Normal Vector3 (0.0, 1.0, 0.0) The direction the surface faces, straight out of it. A collision reports it as the normal.
Output Type Description
Result Vector3 The bounced vector.

Phases StartEvery FramePhysicsEnd

Vector3 Combine

Every Frame
Vector3 Combine Vector
Function 'distance_to' | A (0.0, 0.0, 0.0) | B (0.0, 0.0, 0.0)

Turns two 3D vectors into one number, such as how far apart two points are or the angle between them.

Input Type Default Description
Function String 'distance_to' distance_to is how far apart they are, dot tells how much they point the same way, and angle_to gives the angle between them.
A Vector3 (0.0, 0.0, 0.0) The first vector.
B Vector3 (0.0, 0.0, 0.0) The second vector.
Output Type Description
Result float The resulting number. The angle function answers in degrees.

Phases StartEvery FramePhysicsEnd

Vector3 Cross

Every Frame
Vector3 Cross Vector
A (0.0, 0.0, 0.0) | B (0.0, 0.0, 0.0)

Takes two 3D directions and gives the one standing at a right angle to both. Feeding the facing direction and the up direction gives the side direction, which is how strafing left and right is worked out.

Input Type Default Description
A Vector3 (0.0, 0.0, 0.0) The first vector.
B Vector3 (0.0, 0.0, 0.0) The second vector.
Output Type Description
Result Vector3 The direction at a right angle to both, such as the side of a body.

Phases StartEvery FramePhysicsEnd

Vector3 Direction To

Every Frame
Vector3 Direction To Vector
From (0.0, 0.0, 0.0) | To (0.0, 0.0, 0.0)

Gives the direction that points from one place to another in 3D, always exactly one unit long so it carries no speed of its own. Multiply it with Scale Vector3 to turn it into a velocity.

Input Type Default Description
From Vector3 (0.0, 0.0, 0.0) The starting point.
To Vector3 (0.0, 0.0, 0.0) The point to aim at.
Output Type Description
Result Vector3 The direction from From to To, one unit long.

Phases StartEvery FramePhysicsEnd

Vector3 Info

Every Frame
Vector3 Info Vector
Function 'length' | Vector (0.0, 0.0, 0.0)

Reads one number out of a 3D vector, most often its length. Feeding a velocity to length gives the current speed.

Input Type Default Description
Function String 'length' length is how long it is, and length_squared skips the square root, good enough to compare two distances.
Vector Vector3 (0.0, 0.0, 0.0) The vector to read.
Output Type Description
Result float The resulting number.

Phases StartEvery FramePhysicsEnd

Vector3 Lerp

Every Frame
Vector3 Lerp Vector
From (0.0, 0.0, 0.0) | To (0.0, 0.0, 0.0) | Weight 0.5

Blends two 3D vectors by a weight and stores the result. Weight 0 is the first, 1 is the second.

Input Type Default Description
From Vector3 (0.0, 0.0, 0.0) The value at weight 0.
To Vector3 (0.0, 0.0, 0.0) The value at weight 1.
Weight float 0.5 How far from the first to the second, 0 to 1.
Output Type Description
Result Vector3 The blended vector.

Phases StartEvery FramePhysicsEnd

Vector3 Limit Length

Every Frame
Vector3 Limit Length Vector
Vector (0.0, 0.0, 0.0) | Max 1.0

Shortens a 3D vector when it is longer than Max, and leaves it alone when it is not. Capping a velocity is what stops diagonal movement from being faster than walking straight.

Input Type Default Description
Vector Vector3 (0.0, 0.0, 0.0) The vector to cap.
Max float 1.0 The longest the vector may be.
Output Type Description
Result Vector3 The capped vector.

Phases StartEvery FramePhysicsEnd

Vector3 Math

Every Frame
Vector3 Math Vector
A (0.0, 0.0, 0.0) | Operator '+' | B (0.0, 0.0, 0.0)

Combines two 3D vectors with an arithmetic operator, such as add or multiply. Adding is how a position gets offset.

Input Type Default Description
A Vector3 (0.0, 0.0, 0.0) The left-hand vector.
Operator String '+' The arithmetic operation to apply.
B Vector3 (0.0, 0.0, 0.0) The right-hand vector.
Output Type Description
Result Vector3 The resulting vector.

Phases StartEvery FramePhysicsEnd

Vector3 Rotated

Every Frame
Vector3 Rotated Vector
Vector (0.0, 0.0, -1.0) | Axis (0.0, 1.0, 0.0) | Angle 0.0

Rotates a 3D vector around an axis by an angle and returns the turned vector.

Input Type Default Description
Vector Vector3 (0.0, 0.0, -1.0) The vector to rotate.
Axis Vector3 (0.0, 1.0, 0.0) The axis to turn around. It is normalized before use.
Angle float 0.0 How far to turn it, in degrees.
Output Type Description
Result Vector3 The rotated vector.

Phases StartEvery FramePhysicsEnd

Vector3 To Vector2

Every Frame
Vector3 To Vector2 Vector
(0.0, 0.0, 0.0)

Drops the height of a 3D vector and keeps the ground part as a flat one, such as reading how a body moves along the floor.

Input Type Default Description
Vector Vector3 (0.0, 0.0, 0.0) The 3D vector to flatten, such as a velocity.
Output Type Description
Result Vector2 The X and Z of the vector, as a flat one.

Phases StartEvery FramePhysicsEnd

Vector3 Transform

Every Frame
Vector3 Transform Vector
Function 'normalized' | Vector (0.0, 0.0, 0.0)

Reshapes a 3D vector and stores the new one, most often to normalize it: keep the direction but set the length to 1, so it stops carrying a speed.

Input Type Default Description
Function String 'normalized' normalized keeps the direction and sets the length to 1, abs drops the minus signs, and floor, ceil and round snap to whole numbers.
Vector Vector3 (0.0, 0.0, 0.0) The vector to transform.
Output Type Description
Result Vector3 The resulting vector.

Phases StartEvery FramePhysicsEnd