Panda3D Manual: Joystick Support
<<prev | top | next>> |
Note: I have been told that these instructions are inaccurate. - Josh While Panda3D has mouse and keyboard support, it is best to look to the open source community for joystick support. Pygame is an open-source module that contains joystick support that may be easily included into a Panda3D application. Pygame may be found at http://www.pygame.org. After downloading pygame, simply import the modules as you would any Panda3D module.
import pygame
Once pygame is imported, it needs to be initialized. Also, when the program is through with using pygame, it should be exited cleanly.
pygame.init() pygame.quit()
Also, the joystick should be initialized. It too has a quit function.
joystick.init() joystick.quit()
From here, it is possible to get the axis information of the joystick as well as the state of the buttons.
joystick.get_axis(<Axis>) joystick.get_button(<Button>)
These are the primary functions for the joystick, but there are a number of other functions available for joystick support. This can be found at the pygame website.
<<prev | top | next>> |