WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-04-2011, 01:19 PM
EnvisMJ EnvisMJ is offline
Member
 
Join Date: May 2009
Location: Purdue University, West Lafayette, Indiana
Posts: 44
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?
Reply With Quote
  #2  
Old 02-04-2011, 05:21 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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.
Reply With Quote
  #3  
Old 11-07-2012, 04:55 PM
tokola tokola is offline
Member
 
Join Date: Nov 2012
Posts: 67
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.
Reply With Quote
  #4  
Old 11-08-2012, 12:19 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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)
Reply With Quote
  #5  
Old 11-10-2012, 05:15 PM
tokola tokola is offline
Member
 
Join Date: Nov 2012
Posts: 67
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)?
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
gamepad problem shai Vizard 1 08-25-2005 01:09 PM
input & gamepad dominic Vizard 1 08-15-2005 04:01 PM
gamepad dominic Vizard 1 08-15-2005 10:14 AM


All times are GMT -7. The time now is 03:02 AM.


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