RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Flowgraph Base ModuleFlowgraph Base NodeFlowgraph Base State NodeFlowgraph Node BuilderFlowgraph GraphFlowgraph Group HelperFlowgraph LinkFlowgraph ManagerNew Node TemplateFlowgraph PinFlowgraph States ManagerFlowgraph UtilsFlowgraph Variable Storage
Collection Marker (Flowgraph Node)Custom Lua Command (Flowgraph Node)Get Object Field (Flowgraph Node)Get Player Vehicle ID (Flowgraph Node)Get Point on Decalroad (Flowgraph Node)Show/Hide Object (Flowgraph Node)ID by Name (Flowgraph Node)Keep Prefab (Flowgraph Node)Particle Emitter (Flowgraph Node)Point on Decalroad (Flowgraph Node)Raceline Parking (Flowgraph Node)Raycast (Flowgraph Node)Parking Markers / Rect Marker (Flowgraph Node)Reload Collision (Flowgraph Node)Reload Nav Graph (Flowgraph Node)Remove Prefab (Flowgraph Node)Reset Prefab (Flowgraph Node)Set Object Field (Flowgraph Node)Sevensegment Display (Flowgraph Node)Single Marker (Flowgraph Node)Spawn Light / SpotLight (Flowgraph Node)Spawn Prefab (Flowgraph Node)Spawn TSStatic (Flowgraph Node)Store Statics (Flowgraph Node)Track Prefab (Flowgraph Node)

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsflowgraphnodesscene

Raycast (Flowgraph Node)

- **Node Name:** `Raycast`

Overview

  • Node Name: Raycast
  • Category: repeat_instant
  • File: extensions/flowgraph/nodes/scene/raycast.lua

Casts a ray and hits the first static collision object (TSStatics, Terrain, etc.).

Pin Schema

Input Pins

PinTypeDescription
posvec3Start position of the raycast
dirvec3Direction of the raycast
distnumber(Hidden) Maximum distance (default 1000)

Output Pins

PinTypeDescription
hitflowOutflow if the ray hit something
missflow(Hidden) Outflow if nothing was hit within dist
posvec3Hit position
distnumberDistance from origin to hit point

Internals

FieldPurpose
self.data.debugWhen true, draws debug spheres and lines

Behavior

  • work() - Each frame:
    • Calls castRayStatic(pos, dir, dist) to find the nearest static hit.
    • Computes hit position as pos + normalized(dir) * hitDist.
    • Sets hit flow if hitDist < dist, otherwise sets miss.
    • Optional debug drawing shows start (red), hit (green), and connecting line (blue).

How It Works

  1. The node takes a position and direction vector each frame.
  2. If no explicit distance is provided, uses the length of the direction vector.
  3. castRayStatic() returns the distance to the nearest static collision surface.
  4. The hit position is calculated and output along with the distance.

Example Usage

-- Check ground height below a point:
-- pos = {100, 200, 500}
-- dir = {0, 0, -1}
-- dist = 1000
-- Output pos.z gives the terrain height at (100, 200)

Key Dependencies

  • castRayStatic(pos, dir, dist) - engine function for static collision raycasting

Additional Methods

C:init()

Initializes the node, setting up pins and default properties.


See Also

  • Collection Marker (Flowgraph Node) - Related reference
  • Custom Lua Command (Flowgraph Node) - Related reference
  • Get Object Field (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Raceline Parking (Flowgraph Node)

- **Node Name:** `Raceline Parking`

Parking Markers / Rect Marker (Flowgraph Node)

- **Node Name:** `Parking Markers`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsBehaviorHow It WorksExample UsageKey DependenciesAdditional MethodsC:init()See Also