Ray

Category: Listener Tier: Basic

Purpose

Casts a ray from the object in a specified direction and triggers when the ray hits something, with optional filtering.

Visual Reference

As added to your scene
Ray brick as it appears in the GDLink editor

When To Use

  • Ground detection (raycast down to check if on floor)

  • Line of sight (AI checks if player is visible)

  • Wall detection (raycast forward to avoid obstacles)

  • Targeting systems (check if crosshair points at enemy)

  • Hover effects (raycast to detect surface below vehicle)

  • Projectile preview (show where bullet will land)

Runtime Behavior

Triggers: When raycast hits an object matching the filter criteria within range

Generated UI Mockup — showing expanded properties
Ray
-
x
Name:
Label this brick...
Axis:
+Z
Range:
10.0
v
Cone Angle:
0.0
v
Width:
0.0
v
Filter:
Any
Target:
v
Value:
v
Expose Scope:
Local
Expose Prefix:
ray
v
Local
Hit Data
Visual Debug
Invert

Properties

Property

Type

Default

Notes

Axis

option

+Z

Ray direction (local or world space)

Range

float

10.0

Maximum raycast distance

Cone Angle

float

0.0

If > 0, performs a cone/triangular scan instead of a narrow ray

Width

float

0.0

Breadth of the ray (using shape casting)

Local

bool

True

Cast ray relative to object rotation (True) or world axes (False)

Filter

option

Any

Filter type for raycast hits

Target

string

Name/Group/Property to match

Value

string

Expected property value

Hit Data

bool

False

Store hit point/normal/distance in Local Variables

Expose Scope

option

Local

Where exposed ray variables are written

Hit Var

variable_name

Variable that receives whether the ray hit

Dist Var

variable_name

Variable that receives hit distance

Target Dist Var

variable_name

Variable that receives target distance

Half Dist Var

variable_name

Variable that receives half target distance

Hit Point Var

variable_name

Variable that receives hit point

End Point Var

variable_name

Variable that receives ray end point

Target Point Var

variable_name

Variable that receives hit point or ray end point

Normal Var

variable_name

Variable that receives hit normal

Object Var

variable_name

Variable that receives hit object name

Expose Prefix

string

ray

Compatibility fallback when explicit output variables are empty

Visual Debug

bool

False

Draw the ray in the editor/game for debugging

Example Use Cases

Ground Detection:

Ray(axis=-Y, range=0.2, target=Any) -> AND -> Property(is_grounded, Set, true)
// Check if ground is within 0.2 units below

AI Line of Sight:

Ray(axis=+Z, range=20, target=Object Name, name=Player) -> AND -> Property(can_see_player, Set, true)
// Detect if player is in front within 20 units

Wall Avoidance:

Ray(axis=+X, range=2.0, target=Group, name=Obstacles) -> AND -> Rotation(turn)
// Turn when wall detected within 2 units ahead

Hover Vehicle:

Ray(axis=-Y, range=5.0, expose_hit_data=true) -> AND -> Math(hover_height, Set, ray_distance)
// Measure distance to ground for hover control