Game Development Reference
In-Depth Information
How it works...
A joystick is an input device, just like the mouse or keyboard. While there is a way to map
the actions in the same way, with InputManager.addMapping() , the recommended
way is to do the reverse and assign actions to the joystick instead. Remember that In-
putManager still needs to listen to the mappings.
Mapping buttons is even trickier than axes. First of all, there are two types of buttons, ana-
log and digital. On a controller, usually the lower-right and left buttons controlled by the
index fingers are analog, whereas all other buttons usually are digital. In jMonkeyEngine,
everything analog is an axis. So, you will find that most likely, these will be reported as an
axis.
Note
On my controller, a Razer Hydra, left and right triggers are reported as the z axis.
As if that's not enough, all you have to work with is a button index. Fortunately, with most
game controllers emulating one of the big brands of console makers, some kind of standard
can be expected. However, there are exceptions, and for any serious game, an interface
where the user can remap their device is a must.
Search WWH ::




Custom Search