VR-Forces 5.2 Lua Function Documentation

SwingingArtPart

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

The SwingingArtPart is a class of Lua object that represents a rotating articulated part. The functions defined below are methods available for this class of object.

Lua scripts cannot create SwingingArtParts, but if an entity uses a swinging articulated part actuator in one of its systems, then that actuator is automatically defined for the script. The name of the object in the Lua environment is the name of the component, found in the data file (e.g. a .sysdef file).

Example: in the fixed-wing-fighter-jet.sysdef file describing a fixed-wing movement system, there is a landing gear actuator with component-type = "swinging-part-actuator." The name of this component in the system is "landinggear" (see excerpt below). Thus a Lua script could call
landinggear:open()
to lower the landing gear.

 (actuators 
(landinggear
(component-descriptor-type "swinging-part-actuator-descriptor")
(component-type "swinging-part-actuator")
...

Function List

close (rate) Starts the closing of the articulated part.
isClosed ()
isOpened ()
open (rate) Starts the opening of the articulated part.
reset () Resets the state of the art part to NoState to allow other controllers to control art part


Functions

close (rate)
Starts the closing of the articulated part.

Parameters:

  • rate: Number. Optional. Rate at which the part moves (radians/sec).
isClosed ()

Return value:

    True if the art part is closed.
isOpened ()

Return value:

    True if the art part is open.
open (rate)
Starts the opening of the articulated part.

Parameters:

  • rate: Number. Optional. Rate at which the part moves (radians/sec).
reset ()
Resets the state of the art part to NoState to allow other controllers to control art part

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