LaserLight
(For high level concepts about how to use Lua to write scripted tasks, please see VR-Forces User's Guide.)
The LaserLight is a laser that rotates. It is represented in Lua by two classes, laser-light-controller and a laser-light-actuator. The functions defined below are methods available for objects of these classes.
Lua scripts cannot create LaserLights, but if an entity uses a laser light controller and actuator in one of its systems (e.g. the Laser Light system), then laser light controller and actuator objects are automatically defined for the Lua API for that entity. Each laser light is identified by its Laser Light ID as configured for the entity's laser system in the the Simulation Object Editor. The name of the controller object is the Laser Light ID with '.' and ' ' replaced by '_', and the string "_Controller" added to the end. Similarly, the name of the actuator object is the Laser Light ID with '.' and ' ' replaced by '_', and the string "_Actuator" added to the end. Example: If an entity has a laser light system with a Laser Light ID of "Laser Light". Thus a Lua script could call
Laser_Light_Actuator:laserLightLimitHit()
to query the actuator to find if the gimbal limit of the laser has been hit.
To make the laser point at something, use vrf:executeSetData("set-aim-laser-light"...) and indicate a mode to track a target, point at a location, or point at an angle. See the Set Catalog.
Function List
| laserLightLimitHit () | Determines if a laser light has reached a rotation limit. |
| lookingAt () | Returns the location that the laser light is pointed at. |
| mode () | Gets a string representing the current mode of the laser light. |
| orientation () | Gets the azimuth and elevation of laser light. |
Functions
- laserLightLimitHit ()
-
Determines if a laser light has reached a rotation limit. This is a laser light actuator function.
Usage:
hitLimit =
_Actuator:laserLightLimitHit() Return value:
- (boolean) True if laser light is in a position where it has reached its rotation limit on at least one axis.
- lookingAt ()
-
Returns the location that the laser light is pointed at. Controller function.
Usage:
spotting =
_Controller:lookingAt() Return value:
- (Location3D) The location the laser light is pointed at.
- mode ()
-
Gets a string representing the current mode of the laser light. This is a laser 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 laser light. Controller function.
Usage:
azimuth, elevation =
_Controller:orientation() Return values:
- (number) The azimuth in radians.
- (number) The elevation in radians.
