WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   2nd Analog Stick on Gamepad (https://forum.worldviz.com/showthread.php?t=3419)

EnvisMJ 02-04-2011 01:19 PM

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 )

Any suggestions?

Jeff 02-04-2011 05:21 PM

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.

tokola 11-07-2012 04:55 PM

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.

Jeff 11-08-2012 12:19 PM

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)


tokola 11-10-2012 05:15 PM

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)?


All times are GMT -7. The time now is 11:15 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC