Using controllers with two analog sticks...

Blitz3D Forums/Blitz3D Beginners Area/Using controllers with two analog sticks...

SuperRoboFan(Posted 2009) [#1]
If you are using a joystick with two analog sticks, is it possible for a Blitz3d game to be programmed so that it used both of them? If so, how is it done?


Ginger Tea(Posted 2009) [#2]
yes blitz can use both analog sticks at the same time, they vary from controller to controller but are normally x and y axis

there is an excelent example of dual stick controller method posted here a while back, one stick controlling the left and the other right thrusters of a hover vehicle
edit:
http://www.blitzbasic.com/Community/posts.php?topic=77308

and a util by pongo
http://www.blitzbasic.com/codearcs/codearcs.php?code=1592


GIB3D(Posted 2009) [#3]
Try this joystick example, move both joysticks around and see what values change.



SuperRoboFan(Posted 2009) [#4]
To GIB3D:

Are you using Biltz3D SDK? Because my Blitz3D didn't recognize a lot of the commands in your snippet of code...


Guy Fawkes(Posted 2009) [#5]
to robofan: can u post the control stick code please? ^^


SuperRoboFan(Posted 2009) [#6]
Control stick code?


Guy Fawkes(Posted 2009) [#7]
i meant the dual analog stick code.


Stevie G(Posted 2009) [#8]
I'm not sure where GIB3d got those commands but most of them are indeed nonsense ...

Replace them with these commands ..

JoyX( Port )
JoyY( Port )
JoyZ( Port )
JoyPitch( Port)
JoyRoll( Port )
JoyYaw( Port )
JoyU( Port )
JoyV( Port )
JoyHat( Port )


On a PS2 controller

L stick = JoyX for left/right , JoyY for up/down
R stick = JoyRoll for left/right, JoyZ for up/down

Note that you must divide the output from JoyRoll by 180.0 to get a valid result between -1 and 1.

Stevie


GIB3D(Posted 2009) [#9]
I got them straight out of the JoyV example in the help documents. It's the same example for JoyU, JoyYaw, JoyPitch, JoyRoll and some of the other ones.

Edit:
I'm not sure where GIB3d got those commands but most of them are indeed nonsense ...

If I made the example I wouldn't have done it like that either, I just copied and pasted.


SuperRoboFan(Posted 2009) [#10]
I just updated my Blitz3D, and now I can use both joysticks! Thanks for the help!


Guy Fawkes(Posted 2009) [#11]
@superrobofan, can u release the source for the joysticks?