SP3 feature: Joystick and Keyboard.
-
@platypus5 said:
Also, would it be possible to assign your own keys to the controllers?for example, have "space" trigger the piston behind a piston-gun?
The motorboat example uses keyboard for servo and magnet control.
I decided not to support arbitrary keyboard access because there would be all kinds of configuration problems with non-english keyboards. But I will map the spacebar to one of the buttons.
-
@cphillips said:
@platypus5 said:
Also, would it be possible to assign your own keys to the controllers?for example, have "space" trigger the piston behind a piston-gun?
The motorboat example uses keyboard for servo and magnet control.
I decided not to support arbitrary keyboard access because there would be all kinds of configuration problems with non-english keyboards. But I will map the spacebar to one of the buttons.
true....oh well. it would make tank style steering much easier.
-
Updated first post with new sample. Also I found a bug where keyboard emulation of the right y axis (UP/DOWN) seems to be backwards. Fixed in next release.
-
I'm using a 360 style wired joypad. This is what my controls do:
A=B
X=A
Y=Y
B=XAnalog triggers= joyRY
Triggers=Triggers
Left stick=joyLX,joyLY,leftx,lefty
Right stick=rightx,righty
Other=joyRX doesn't workWill I be able to fix this with the config utility? Does anyone else have a similar problem?
-
@wacov said:
I'm using a 360 style wired joypad. This is what my controls do:
A=B
X=A
Y=Y
B=XAnalog triggers= joyRY
Triggers=Triggers
Left stick=joyLX,joyLY,leftx,lefty
Right stick=rightx,righty
Other=joyRX doesn't workWill I be able to fix this with the config utility? Does anyone else have a similar problem?
Except the buttons (ABXY) that looks about right. Your specific controller must map those buttons differently. And yes the config should fix this problem.
-
Is there any support for the individual triggers on an xbox controller. IM trying to make a car using them for accelerator and brake but i dont want to use joyRY for various reasons.
-
Are you talking about the two analog triggers on top of the controller? If so that is "lt" and "rt". BUT. They dont quite behave as you'd expect. If you hold the left one down you will get a value of -1 and if you hold the right one down you will get a 1 if you hold both down you get a value of 0.
-
@sgt.a.johnson said:
Is there any support for the individual triggers on an xbox controller. IM trying to make a car using them for accelerator and brake but i dont want to use joyRY for various reasons.
I think I see what you want to do... you only want the input from one trigger or the other, not both? If you stil want it to be analog, try:
if joyRY>0.5 joyRY else 0.5 end
(Reverse to < for the other trigger)
Or, if you just want it to act as on/off:
if joyRY>0.5 1 end
Overall, pretty simple stuff. It can be further shortened with:
joyRY>0.5? joyRY;0.5
or:
joyRY>0.5? 1;0
Hope this helps!
I suppose something of note is my trigger input seems to be reversed... my left trigger gives a positive value, and vise versa.
-
@cphillips said:
Are you talking about the two analog triggers on top of the controller? If so that is "lt" and "rt". BUT. They dont quite behave as you'd expect. If you hold the left one down you will get a value of -1 and if you hold the right one down you will get a 1 if you hold both down you get a value of 0.
Thats what happens when i use joyRY but i want to be able to use both triggers at the same time but for 2 different things. best example i can think of is halo using duel wield to have a gun in either hand
-
I understand. But it will have to wait for a future version. Microsoft has two different controller api's. One for pc style joystics and one for 360 style. I used the common one because thats what most folks have. I will add the 360 style as soon as I can.
-
how to use this code? is this ruby?
@unknownuser said:
if joyRY>0.5 > joyRY > else > 0.5 > end
(Reverse to < for the other trigger)
-
edit
Advertisement