PDA

View Full Version : Joystick setForce


tsgk
05-19-2010, 05:59 AM
Hello all,

I have a (hopefully) quick question with regards to one of the joystick options, the <vizjoy:joystick>.setForce([x,y]) where [x,y] is the force vector you want to set to the FFB device.
Has anyone used this command succesfully to moderate the strength of the FFB? There are no examples in the Help files.. Help!! How do I use this? What values can I put to the force vector?

Thanks in advance!!

levisii
05-31-2011, 04:35 AM
Hi,

did you try the <vizjoy:joystick>.hasFFB() function? I was wondering too, why I'm not able to generate any ff-effect. Seems like the ffb-function of my joystick can't be identified. This is my testprogram:


import viz
import vizjoy

viz.go()
joystick = vizjoy.add()
print 'FFB = ' + str(joystick.hasFFB())

def joyButton(e):
if e.button == 1:
joystick.addForce(0.5,0)
print '1'

if e.button == 2:
joystick.setForce(0,0.5)
print '2'

if e.button == 3:
e.joy.addAction(vizjoy.recoil(0.8))
print '3'

if e.button == 4:
e.joy.addAction(vizjoy.rumble(0.4))
print '4'

viz.callback(vizjoy.BUTTONDOWN_EVENT,joyButton)


this is my print out:

** NOTIFY: 1 joystick(s) detected
1 - Logitech Force 3D Pro
** NOTIFY: Connected to Logitech Force 3D Pro
Supported: X Axis, Y Axis, Rz, Slider, 12 Buttons, Hat switch,
FFB = False

levisii
06-07-2011, 06:09 AM
update:

Well, it was just a problem with the driver. The example is working now.