VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Joystick Controller (joystick)

Table of Contents

Warning
This example provides the code that used to drive much of the joystick controls in VR-Forces. This capability is now deprecated, but the code is provided here for users who wish to use it as a starting point for their own joystick controls. This is not a supported or tested example.

The Joystick Controller demonstrates the following

Creating Joystick Controller

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.

How to Run the Example

Usage

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:

  1. When creating a new scenario you will also need to use the Joystick simulation model set from the developer examples simulation model sets.
  2. Create any of the entities that use the joystick enabled systems to enable joystick control (such as an M1A2 or F/A 18).

Classes

DtBallisticGunJoyWorks in conjuntion with DtBallisticGunJoyController to control a rotating/elevating ballistic gun. These controllers are used the the mm_gun.template_sysdef
DtFixedWingJoyFlightControllerUsed to control fixed wing movement. This is used in the fixed-wing-high-maneuverability-fighter.sysdef
DtRotaryWingJoyFlightControllerUsed to control rotary wing movement. This is used in the rotary-wing-attack.sysdef
DtGroundJoyTurretControllerUsed to control turret slew. This is used in the mm_gun.template_sysdef

Joystick Configuration

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.

Plugin Entry Points

/*******************************************************************************
** Copyright (c) 2017 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
#include "vrfcgf/cgf.h"
extern "C" {
{
info.pluginName = "Joystick Controller";
info.pluginVersion = "2.00";
info.pluginCreator = "MAK Technologies";
info.pluginCreatorEmail = "sales@mak.com";
info.pluginContactWebPage = "www.mak.com";
info.pluginContactMailingAddress = "10 Fawcett Street, Suite 204, Cambridge, MA 02138 USA";
info.pluginContactPhone = "(617) 876 8085";
}
DT_VRF_DLL_PLUGIN bool DtInitializeVrfPlugin(DtCgf* cgf)
{
//Register the creation function for our derived controller with the
//DtSimComponentFactory.
return true;
}
}



Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)