Skip to main content
Version: 4.0.0

Ray Cast 2D

Detects intersections with colliders in the 2D environment by casting a ray from one point in space to another. All determines if the ray should extend to its entire length, while Near will stop at the nearest object it hits.

Input

NameData TypeDescription
StartExecStarts the ray cast
Ray TypeStringDetermines if the ray should extend to its entire length, or stop at the nearest object it hits
OriginVec2The starting point of the ray. You can provide a 2D vector value as the ray's origin.
DirectionVec2The direction in which the ray will be cast. You can provide a 2D vector value as the ray's direction.
LengthNumberThe maximum length the ray should extend. If not provided, the ray will extend infinitely.

Output

NameData TypeDescription
NextExecExecutes the next node
Ray HitBooleanOutputs true if the ray cast hits an object; false if not. Connect this output to other nodes to create custom logic based on the ray cast result.
Hit Info Array2D ArrayThe result of the ray cast if it intersects with a collider. Connect this output to a Ray Hit Info node to access the information.