VR-Forces 5.3 Lua Function Documentation

SearchLight

(For high level concepts about how to use Lua to write scripted tasks, please see VR-Forces User's Guide.)

The SearchLight is a system that rotates. It is represented in Lua by two classes, search-light-controller and a search-light-actuator. The functions defined below are methods available for objects of these classes.

Lua scripts cannot create SearchLights, but if an entity uses a search light controller and actuator in one of its systems (e.g. the Search Light system), then search light controller and actuator objects are automatically defined for the Lua API for that entity. Each search light is identified by its Search Light ID as configured for the entity's sensor system in the the Simulation Object Editor. The name of the controller object is the Search Light ID with '.' and ' ' replaced by '_', and the string "_Controller" added to the end. Similarly, the name of the actuator object is the Search Light ID with '.' and ' ' replaced by '_', and the string "_Actuator" added to the end. Example: If an entity has a search light system with a Search Light ID of "Search Light". Thus a Lua script could call
Search_Light_Actuator:searchLightLimitHit()
to query the actuator to find if the gimbal limit of the sensor has been hit.

To make the search light point at something, use vrf:executeSetData("set-aim-search-light"...) and indicate a mode to track a target, point at a location, scan, or point at an angle. See the Set Catalog.

Function List

lookingAt () Returns the location that the search light is looking at (as if it were lasing).
mode () Gets a string representing the current mode of the search light.
orientation () Gets the azimuth and elevation of search light.
searchLightLimitHit () Determines if a search light has reached a rotation limit.


Functions

lookingAt ()
Returns the location that the search light is looking at (as if it were lasing). Controller function.

Usage:

    spotting = _Controller:lookingAt()

Return value:

    (Location3D) The location the search light is looking at.
mode ()
Gets a string representing the current mode of the search light. This is a search light controller function.

Usage:

    trackingMode = _Controller:mode()

Return value:

    (string) A string indicating the current tracking mode. Expected values are "FIXED ANGLE", "TRACK ENTITY", "TRACK LOCATION", "SCAN", "MANUAL", and "UNKNOWN".
orientation ()
Gets the azimuth and elevation of search light. Controller function.

Usage:

    azimuth, elevation = _Controller:orientation()

Return values:

  1. (number) The azimuth in radians.
  2. (number) The elevation in radians.
searchLightLimitHit ()
Determines if a search light has reached a rotation limit. This is a search light actuator function.

Usage:

    hitLimit = _Actuator:searchLightLimitHit()

Return value:

    (boolean) True if search light is in a position where it has reached its rotation limit on at least one axis.

Copyright© 2026 MAK Technologies, Inc. All rights reserved.