![]() |
VR-Forces Developer's Guide
|
The Joystick Controller demonstrates the following
This example implements functionality that used to exist in the VR-Forces product, however, has now been moved to an example to allow for greater enhancement by users. The controllers shown build on the existing limited joystick capability supplied in VR-Forces to allow you to create higher fidelity weapon and movement models. The code supplied is the code that used to be in the VR-Forces product, however, has been made available for modification. You can use these controllers and systems as a starting point for adding your joystick functionality and controler. Below is a description of the controller added here.
Since this example is loaded as a plugin, it can be used in conjunction with the released VR-Forces application.
In the Launcher, click the Plug-ins button to bring up the Plug-ins Selection dialog. Enable the joystick plugin.
To view the new behavior:
| DtBallisticGunJoy | Works in conjuntion with DtBallisticGunJoyController to control a rotating/elevating ballistic gun. These controllers are used the the mm_gun.template_sysdef |
| DtFixedWingJoyFlightController | Used to control fixed wing movement. This is used in the fixed-wing-high-maneuverability-fighter.sysdef |
| DtRotaryWingJoyFlightController | Used to control rotary wing movement. This is used in the rotary-wing-attack.sysdef |
| DtGroundJoyTurretController | Used to control turret slew. This is used in the mm_gun.template_sysdef |
Joysticks are configured in the sydefs the controllers reside in by extending the controllers descriptors to include definition of the joystick controler. The fixed wing movement, for example:
(joystick-controls
(pitch
(function-name "pitch")
(function-group $flight-controls)
(description "Controls pitch of this entity")
(min-value -1.000000)
(max-value 1.000000)
(cycle False)
)
(roll
(function-name "roll")
(function-group $flight-controls)
(description "Controls the roll of this entity")
(min-value -1.000000)
(max-value 1.000000)
(cycle False)
)
(throttle
(function-name "throttle")
(function-group $flight-controls)
(description "Controls the throttle of this entity")
(min-value 0.000000)
(max-value 1.000000)
(cycle False)
)
(pedal
(function-name "pedal")
(function-group $flight-controls)
(description "Fixed wing pedal")
(min-value -1.000000)
(max-value 1.000000)
(cycle False)
)
)
Each joystick section contains a function group and a list of functions controlled by that group. The function groups are used for an overall organization of entire sets of functionality to assign to a joystick. The function within that particular group can be assigned to a joystick element to control that function.