joystick second analog stick
Blitz3D Forums/Blitz3D Programming/joystick second analog stick
| ||
Has anyone found an automated way to determine wich axi data corrisoponds to the second anolog stick. I would like for tiny tank to have dual stick support out of the gate, but not at the cost of manual config of a joystick. I dont want to answer countless questions on that in a support forum. So , what I would like to do is test each axi to see if it can be used for the second stick, is there any way to do this? I did see Pogos code in the archives but it appears to require the user config each joystick .. brilliant code, but I dont think Tiny Tank players will bother to run a config. |
| ||
You won't be able to tell what axis the player's joypad uses automatically. Unfortunately there is no standard, even within the same manufacturer. That's why I had to write my code in the first place. What you can do is offer up a few default settings, like the 360 pad which is excellent, and you will know that it will work with anyone that has one of those. I would try to configure something like keyboard for default, but then let them choose from a short list of common pads like the 360, and then finally allow a full custom setup. |
| ||
Good idea Pongo, thanks. |
| ||
Let me know if you need any help setting things up. That code archives example is a bit long winded. I've been meaning to update things with a version that is both more powerful and also more simple, but things keep getting in the way. Once the control mapping system is set up, then it is incredibly easy to swap out new controls. |
| ||
Pongo, you could help me if you want. I dont have a 360 controller, and as sad as it sounds I cant buy one right now. Food is more important. Can you give me the mapping for joystick. First Stick is for movement, second stick is for aiming. and I use two buttons. I have to map the second anolog to simulate mousexspeed() and mouseyspeed() What im looking for is button ID. (button 1 reads X, Button 2 reads Y), and so forth on the buttons. Also the anolog sticks and what axis they use and the min/max values each axi spits out. If you have that data, I would be most appreciative. Thank you |
| ||
Here you go. These are the readouts for the 360 controller Stick 1 X joyX() range is -1(left) to 1(right) Stick 1 Y joyY() range is -1(up) to 1(down) Stick 2 X joyPitch() range -180(left) to 180(right) Stick 2 Y joyYaw() range -180(up) to 180(down) both triggers are on the same reading Joyz() Range is -1(right Trigger) to 1(left trigger) Note: both triggers will cancel each other out, so pulling both will give you 0 which is the same as at rest. In other words, the left trigger is on Joyz() from 0 to 1, and the right trigger is also on Joyz(), but it is from 0 to -1. Buttons using joydown() or joyhit() A 1 B 2 X 3 Y 4 Left Bumper 5 Right Bumper 6 Back 7 Start 8 left stick (click down) 9 right stick(click down) 10 Joypad is the Joyhat() Up 0 right 90 Down 180 left 270 These are just degrees, so up and right will read as 45 |
| ||
nice, thanks again ! |