Blender Joystick demo - docs added

Hey everyone I need some feedback on this.
If you could tell me your specs on your joystick like num axes,buttons

and so on, that would be cool… that way i can make it compatible

I’m using:
gravis GamePad Pro
1 axis
10 buttons

if your not sure here is a example usage for info.


import Joystick as j

j.printInfo()

then check the console.
The script needs to be in your python path or it will not import from
inside blender

this works on my joystick but i’m not too sure how it will work with
different ones

Docs added 8-17-04
download here

let me know what ya think…

I dont have a joystick so i cant test it :frowning:
But i get no errors thought :slight_smile:

I´ve been waiting for this one for a long time. Thanks! Will try it on a “steering wheel joystick”.

So joystick in Blender Realy work then :stuck_out_tongue: ???
That will be Awsome :smiley:

Nice job snailrose!

I tried it with:
Logitech Attack-3
2-axis
11 button

Worked great! Looking at how you got it working I noticed the Joystick.pyd file and looked that up on the net. From what I saw on the pygame.org site that file is for exe’s only? Would it be much different to use your scripts in a regular blend file? I did notice that some of the commands you used to Joystick methods were different than the ones listed on Pygame…(the initialization method, for example, on Pygame is Joystick.init() not Joystick.initJoystick() as you have it)

Again…nice job 8)

Woohoo! snailrose
:smiley:

%| Hmm, joysticks as in arcade style joysticks? I was thinking gamepad for computers like the playstation controllers. Can that be done?

Jason Lin

NOR.J>>
Well at leat it works on other systems then mine

Hush >>
the joystick.pyd is compiled form c++,
I used the SDL Joystick stuff to make it

Rangel >> Let me know If it works!

goldentaiji>> The joystick I’m using Look almost like a playstation controller, same type anyway

when i get more of it done I will write a short tutorial on how to use it, and post the sources

thanks

Saitek P880 Dual Analog

2 Analog Sticks
1 Axis
11 Buttons

COOOOL, it works!

No joystick. :frowning:

Name: Microsoft PC-joystick driver
Number Axes: 4
Number Hats: 1
Number Balls: 0
Number Buttons: 12

not bad [it is a playstation 2 controller]

it does annoy me however that the pressure sensitive buttons [there are 8, 4 are for the d-pad] cannot work in windows… oh well [this is not a problem with SDL, but rather windows’ joystick interface].

tried it with 2 different playstation controllers. need to hook up the 2nd hat and add some rumble and your set!

great work!

16 buttons
4 axis

:o Woah, yeah, so many possibilites with this.

Gravis Destroyer TILT
4 directional buttons
7 other buttons

Axis Pad
4 directional buttons
2 Analog sticks
10 other buttons

It works on both and after testing them all I can say is Snailrose, YOU ROCK!!! :wink:

Jason Lin

Thanks…
here is an update, it has some bug fixes and I added a function to close
the joystick manually… the module automatically closes, so this is not a must
also I added short tutorial/docs on it…

I’m working on more support for the above specs and will update it in a few days

have fun! :slight_smile:

Where is the update?

And also could you do a steering wheel script with the buttons and petals?

sorry :frowning:
Its the same link as above I just switched files on the server

I did find however that with analog sticks the value isn’t set in stone
& it will be possiblle mimic presure sensitivity… at least i’m %90 sure
of that :slight_smile:

Ok I would love to test this out but I need several bits of information.

#1 which files do I put in the python path? There are 7 files in the zip. I assume the blend files do not go there so which of the 5 other files.

#2 What do the two blend files do? And how do I use them?

#3 Which of the blend files do I use?

#4 What is the .exe for. How do I use it?

A little help would be apprectiated.

To paraphrase a college calculus professor of mine:

“It is NOT intuitively obvious to the casual observer”

[Edit.]

Ok I figured out which files to put in the python path. Actually I just copied anything that did not look like a blend :smiley:

Here are the values I got using a gravis gamepad pro USB running under windows ME.

===========Blender Joystick Python Module===========

======================Info==========================
Name: Microsoft PC-joystick driver
Number Axes: 2
Number Hats: 0
Number Balls: 0
Number Buttons: 10

0

get the new version here
Okay, the Joystick.pyd is the file that blender needs to be
able to find

now what this script does:
for each axis that is available, it will return two values,the first

being
a 1 or 0 depending on the direction and the second value being the range

of the axis
so an example would be

import Joystick
Joystick.initJoystick()
Joystick.pumpEvents()

upAxis  = (1, -32768)
downAxis  = (1, 32768)
leftAxis  = (0, -32768)
rightAxis  = (0, 32768)

#then its just a matter of assigning those values to your game events

allaxes = Joystick.thisAxis()
if allaxes == upAxis:
	print "up axis is pressed"

#and the same with the buttons 

button = Joystick.thisButton()

if button == 0:
	print "button zero is pressed"

#In the latest version of this script I added a debug mode 
#which would be 
Joystick.Debug()

then each event processed will be printed to the console
I’m working on getting this more user friendly
if your having problems with it, post it here and i’ll see what i can do
to answer

snailrose: Excuse me if it seemed as though I was putting down or insulting your effort in writing this. I just get real irritated when people release script/add ons for blender and and do not explain how to use them. They seem to feel that since they can use the script anyone can. Well they were the ones who wrote the darn thing in the first place so no wonder they can use it. How about the rest of us mere mortals.

Its just a pet peeve of mine.