SP3 feature: Joystick and Keyboard.
-
SP2 supported up to 2 joypad axis from a Ps2 style controller by setting the values in a joints controller field to "joyLX", "joyLY", etc. That was all and no buttons were supported.
For SP3 the originial "joyLX" values will work as before but there is now support for buttons and even an expanded controller. Currently it is configured to take input from an wired XBOX 360 controller plugged into the USB port. It has to be a wired one because DirectX doesn't recognize the wireless ones (unfortunately)
The new controll values are:
leftx= left joystick in the horizontal direction
lefty= left joystick in the vertical direction
rightx= Right joystick horiz
righty= VerticalAnd for buttons:
a
b
x
y
lb
rb
start
backTriggers are partially supported via "lt" and "rt"
When you run the simulation you can use the WASD and UP/DOWN/LEFT/RIGHT keys to emulate a 360 (and joyLX,joyLY) controller. The buttons are not currently emulated but will be soon.
Issues:
-This feature isnt fully finished yet. Buttons are not mapped to keyboard and some joy axis don't work. Also missing is a config util.
-Make sure the "Control Panel" window has focus when you try to use the keyboard. Otherwise you will probably hit one of SU's hot keys and abort the sim.
-Keyboard UP/DOWN are reversed when emulating joystick. Will be fixed in next release.No video for this one.
-
I am having a hard time getting it to work. Can you show me exactly what I should put if I want a motor to be controllable by the keyboard?
-
Also, would it be possible to assign your own keys to the controllers?for example, have "space" trigger the piston behind a piston-gun?
-
@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