Skip to content

Raycast

Raycast

Casts a ray from an origin in a direction and reports what it hits, writing the results to variables. The origin can be an explicit point or a source object (which is excluded from the hits). Static geometry, dynamic and kinematic objects, and clipping/ignore-collision 'ghost' objects are each disabled by default and enabled with the static, dynamic, and ghosts flags.

Properties

System

Name Explanation Type
Depth The maximum distance to check along the ray, in world units. Variable or Value
Direction X The X component of the ray direction. Variable or Value
Direction Y The Y component of the ray direction. Variable or Value
Direction Z The Z component of the ray direction. Variable or Value
Hit Count Variable The variable to receive the total number of hits, including static geometry. Variable or Value
Hit Dynamic Objects When enabled, the ray hits dynamic and kinematic objects such as entities and actors. Toggle
Hit Ghosts When enabled, the ray also hits objects that are clipping or set to ignore collisions. Toggle
Hit Static Geometry When enabled, the ray hits static geometry such as walls, floors, and static doodads. Toggle
Nearest Distance Variable The variable to receive the distance from the origin to the nearest hit. Variable or Value
Nearest Normal X Variable The variable to receive the X component of the surface normal at the nearest hit. Variable or Value
Nearest Normal Y Variable The variable to receive the Y component of the surface normal at the nearest hit. Variable or Value
Nearest Normal Z Variable The variable to receive the Z component of the surface normal at the nearest hit. Variable or Value
Nearest Point X Variable The variable to receive the X component of the nearest hit point. Variable or Value
Nearest Point Y Variable The variable to receive the Y component of the nearest hit point, which is the hit height. Variable or Value
Nearest Point Z Variable The variable to receive the Z component of the nearest hit point. Variable or Value
Nearest Unique ID Variable The variable to receive the unique ID of the nearest hit object. This is empty when the nearest hit is static geometry. Variable or Value
Origin X The X component of the ray origin, used when no source object is set. Variable or Value
Origin Y The Y component of the ray origin, used when no source object is set. Variable or Value
Origin Z The Z component of the ray origin, used when no source object is set. Variable or Value
Target The physics object to target with this command. Physics Object Reference
Unique IDs Array Variable The variable to receive a nearest-first array of the unique IDs of every hit object. Static geometry hits are not included. Variable or Value
Use Source Object When enabled, the origin is taken from a source object, which is also excluded from the hits. Toggle