Speedtrap Setup

This page explains how to add speed traps and red light cameras to a level.

Speed traps are created from normal level objects:

  • A BeamNGTrigger object that detects vehicles.
  • An optional light object, usually a SpotLight, used as the camera flash.

The trigger contains dynamic fields that tell the game what type of speed trap it is and how it should behave.


Overview

A speed trap setup usually contains:

BeamNGTrigger
SpotLight

The trigger is the functional part. The light is optional and is only used for a visual flash effect.

When a vehicle enters the trigger, the game checks:

  1. Whether the trigger is configured as a speed trap or red light camera.
  2. Whether the vehicle is travelling in the trigger’s forward direction.
  3. Whether the vehicle is above the configured speed threshold.
  4. For red light cameras, whether the linked traffic signal is currently red.
  5. Whether an optional flash light should be activated.
Speed trap speeds are configured in meters per second.

Creating the trigger

In the World Editor, create a BeamNGTrigger and place it where the speed trap should detect vehicles.

The trigger should:

  • Cover the full width of the road or lane.
  • Be a few meters deep in the direction of travel.
  • Be rotated so its positive local Y axis points in the direction vehicles are expected to travel.
  • Have a unique object name.
If the trigger is too thin, fast vehicles may pass through it without being detected reliably.

Trigger direction

The trigger only activates for vehicles travelling in its positive local Y direction.

In other words, the trigger has a forward direction. Vehicles travelling the opposite way are ignored.

Make sure the trigger is rotated correctly:

Positive local Y axis = valid travel direction

If the speed trap does not trigger, the trigger may be facing the wrong way.


Speed trap trigger fields

Select the BeamNGTrigger and add the following dynamic fields.

Required fields

Field Value Description
speedTrapType speed Marks this trigger as a speed trap.
speedLimit Number, in m/s Speed limit used by the trap.

Optional fields

Field Value Description
speedLimitTolerance Number, in m/s Extra speed above the limit before the trap triggers.
speedTrapLightName Object name Name of the light object used for the flash effect.

Example:

speedTrapType = speed
speedLimit = 13.89
speedLimitTolerance = 2.78
speedTrapLightName = speedTrapLight_01

This example represents:

Speed limit: 13.89 m/s ≈ 50 km/h
Tolerance:   2.78 m/s ≈ 10 km/h
Trigger at:  16.67 m/s ≈ 60 km/h

If speedLimitTolerance is not set, the game uses a default tolerance of 10% of the speed limit.


Red light camera trigger fields

A red light camera also uses a BeamNGTrigger, but with different dynamic fields.

Required fields

Field Value Description
speedTrapType redLight Marks this trigger as a red light camera.
trafficSignalId Signal name/id Traffic signal this camera belongs to.

Optional fields

Field Value Description
triggerSpeed Number, in m/s Minimum speed required to trigger the camera.
speedTrapLightName Object name Name of the light object used for the flash effect.

Example:

speedTrapType = redLight
trafficSignalId = trafficSignal_01
triggerSpeed = 5
speedTrapLightName = redLightCameraFlash_01

If triggerSpeed is not set, the default value is:

5 m/s

The camera only triggers if the linked traffic signal is currently red.


Red light camera placement

Place the red light camera trigger near the stop line or just after it, depending on the intersection layout.

The trigger should detect vehicles that enter the intersection while moving through the red light.

Recommended setup:

  • Trigger covers the lane or lanes being monitored.
  • Trigger is aligned with the valid travel direction.
  • Trigger is deep enough to reliably detect fast vehicles.
  • Trigger is placed so vehicles stopped correctly before the line do not trigger it.

Finding the traffic signal ID

For red light cameras, the trigger needs to know which traffic signal it belongs to.

You can inspect traffic signal IDs by enabling traffic signal debug output from the console:

core_trafficSignals.debugLevel = 2

Use the displayed signal name/id as the value for:

trafficSignalId

Example:

trafficSignalId = trafficSignal_01

Creating the flash light

Create a light object near the speed trap or camera.

A SpotLight is commonly used, but any suitable light object can be used if it supports being enabled and disabled.

The light should:

  • Have a unique object name.
  • Be referenced by the trigger’s speedTrapLightName field.
  • Start disabled.

Set the light’s enabled field to:

enabled = false

You can configure the light visually as needed:

  • Color
  • Brightness
  • Range
  • Rotation
  • Cone angle
  • Flare type

For a camera flash, it usually makes sense to use a bright white light with a flare.

Example object name:

speedTrapLight_01

Then set this on the trigger:

speedTrapLightName = speedTrapLight_01
The light is optional. A speed trap can work without a flash object.

Speed units

Speed trap values use meters per second.

Useful conversions:

Speed Meters per second
30 km/h 8.33 m/s
50 km/h 13.89 m/s
60 km/h 16.67 m/s
80 km/h 22.22 m/s
100 km/h 27.78 m/s
120 km/h 33.33 m/s

Formula:

km/h ÷ 3.6 = m/s

For mph:

mph × 0.44704 = m/s

Example: basic speed trap

Objects:

BeamNGTrigger: speedTrapTrigger_01
SpotLight:     speedTrapLight_01

Trigger dynamic fields:

speedTrapType = speed
speedLimit = 22.22
speedLimitTolerance = 2.78
speedTrapLightName = speedTrapLight_01

This creates a speed trap with:

Speed limit: 80 km/h
Tolerance:   10 km/h
Trigger at:  90 km/h

Example: red light camera

Objects:

BeamNGTrigger: redLightCameraTrigger_01
SpotLight:     redLightCameraFlash_01
TrafficSignal: trafficSignal_01

Trigger dynamic fields:

speedTrapType = redLight
trafficSignalId = trafficSignal_01
triggerSpeed = 5
speedTrapLightName = redLightCameraFlash_01

The camera triggers when:

  • A vehicle enters the trigger.
  • The vehicle is travelling in the trigger’s positive local Y direction.
  • The vehicle speed is above 5 m/s.
  • The linked traffic signal is red.

Runtime behavior

When a configured trigger is entered, the game checks the speed trap data.

For normal speed traps:

  • The vehicle speed is compared against speedLimit + speedLimitTolerance.
  • If the vehicle is too fast, the speed trap event is triggered.
  • If a flash light is configured, the light briefly turns on and then off.

For red light cameras:

  • The vehicle speed is compared against triggerSpeed.
  • The linked traffic signal is checked.
  • The camera only triggers when the signal state is red.
  • If a flash light is configured, the light flashes.

Speed traps are ignored when the vehicle is too far away from the active camera.


Leaderboards

In freeroam, speed trap records may be saved per level.

Records are stored by level and trigger name. Because of this, speed trap trigger names should be unique and stable.

Avoid renaming a speed trap trigger after release unless you intentionally want it to use a new leaderboard entry.


Best practices

  • Use one BeamNGTrigger per speed trap or red light camera.
  • Give every trigger and light a clear unique name.
  • Make the trigger wide enough to cover the full detection area.
  • Make the trigger several meters deep for reliable detection.
  • Rotate the trigger so positive local Y points in the valid travel direction.
  • Use meters per second for all speed values.
  • Keep speedTrapLightName exactly the same as the light object’s name.
  • Set the flash light to disabled by default.
  • Use a visible flare type for camera flashes.
  • Test with slow, normal, and fast vehicles.
  • Test both travel directions to make sure only the intended direction triggers.

Common issues

Speed trap does not trigger

Possible causes:

  • speedTrapType is missing or misspelled.
  • The vehicle is travelling opposite the trigger’s positive Y direction.
  • The vehicle speed is below the trigger threshold.
  • The trigger is too thin.
  • The trigger does not cover the lane.
  • The level is running a foreground mission that suppresses freeroam speed trap behavior.

Speed trap triggers from the wrong direction

The trigger is rotated incorrectly.

Rotate the BeamNGTrigger so its positive local Y axis points in the intended travel direction.

Flash does not appear

Possible causes:

  • speedTrapLightName does not match the light object’s name.
  • The light object does not exist.
  • The light is too dim or too far away.
  • The light has no suitable flare or range.
  • The light is already enabled, making the flash hard to notice.

Red light camera does not trigger

Possible causes:

  • speedTrapType is not set to redLight.
  • trafficSignalId is wrong.
  • The traffic signal is not red.
  • triggerSpeed is too high.
  • The trigger is facing the wrong direction.
  • The trigger is not placed at the correct stop line or lane.

Summary

To add a speed trap:

  1. Place a BeamNGTrigger.
  2. Rotate it so positive local Y points in the driving direction.
  3. Add speedTrapType = speed.
  4. Set speedLimit in meters per second.
  5. Optionally add speedLimitTolerance.
  6. Optionally add a disabled SpotLight and reference it with speedTrapLightName.

To add a red light camera:

  1. Place a BeamNGTrigger near the stop line.
  2. Rotate it so positive local Y points in the monitored direction.
  3. Add speedTrapType = redLight.
  4. Set trafficSignalId.
  5. Optionally set triggerSpeed.
  6. Optionally add a disabled flash light and reference it with speedTrapLightName.
Last modified: June 2, 2026

Any further questions?

Join our discord
Our documentation is currently incomplete and undergoing active development. If you have any questions or feedback, please visit this forum thread.