#1
|
|||
|
|||
2nd Analog Stick on Gamepad
We're using a Logitech Wirless Gamepad F710, the default code allows me to access all 12 button inputs and the left analog stick. (Sweet!)
But I'm trying to get input from the second analog stick, and I keep getting "WARNING: Failed to connect to joystick" in the console when I try to add the second one using the code below: Code:
import vizjoy #Add a joystick. This will return the first detected joystick joy = vizjoy.add() joy2 = vizjoy.add() #Initialize global joystick position variable joyPOS = [.00001,.00001] #Record the position of the joystick in for use in onTimer function def joyMove( e ): global joyPOS #Save position in global joyPOS = e.pos #If the joystick position changed, call joyMove viz.callback( vizjoy.MOVE_EVENT, joyMove ) |
#2
|
|||
|
|||
You should use the vizjoy.add command only once. The data from both joysticks will be accessible from that joy object. Depending on the device you are using this information will be encoded in different ways. So, to get the positional information from the second joystick you might have to look at the hat or slider data. Try running joystick.py in the examples->input folder of the Vizard installation to see where that data is showing up.
|
#3
|
|||
|
|||
Same problem of using 2nd analog stick
I am trying to use the right stick and cannot manage to read its position. I have used the joystick.py example but it doesn't work; hat returns position of the D-pad while slider is not working at all. Did someone succeed in reading the 2nd analog?
I am using both a Logitech Rumblepad 2 and a Sony DualSock 3. Thanks a lot. |
#4
|
|||
|
|||
If you run the following script and move the 2nd analog is anything printed in the output window?
Code:
import viz import vizjoy viz.go() vizjoy.add() def buttondown(button): print 'Button',button,'is down' def buttonup(button): print 'Button',button,'is up' def hat(state): print 'Hat changed to',state def slider(state): print 'Slider changed to',state def joymove(x): print 'Joystick has moved to',x.pos def twist(val): print 'Twist changed to',val #Set all the joystick callbacks viz.callback(vizjoy.BUTTONDOWN_EVENT,buttondown) viz.callback(vizjoy.BUTTONUP_EVENT,buttonup) viz.callback(vizjoy.SLIDER_EVENT,slider) viz.callback(vizjoy.HAT_EVENT,hat) viz.callback(vizjoy.MOVE_EVENT,joymove) viz.callback(vizjoy.TWIST_EVENT,twist) |
#5
|
|||
|
|||
Thanks for replying. I have tested the DualShock with that code before and it didn't work. I haven't probably checked the Rumblepad which eventually reads the right analog as twist (y axis) and slider (x axis) data.
Is there any way to read the Sony DS3 as well, or it's dependent on the driver? It basically runs using a virtual controller called MotioninJoy, since the device is originally for the Play Station. Is there a list of recommended joysticks for use with Vizard or any other plugins designed for specific joypad devices (similar to the wii.dle)? |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
gamepad problem | shai | Vizard | 1 | 08-25-2005 02:09 PM |
input & gamepad | dominic | Vizard | 1 | 08-15-2005 05:01 PM |
gamepad | dominic | Vizard | 1 | 08-15-2005 11:14 AM |