|Thomas H. (Patar)||15.08.2010 15:55|
i want to make a mod in which i use a button and an axis for the same funktion.
but if i write this in the moddesc:
<input name="XYZ" key1="KEY_n" button="" />
i cant set an axis, and if i write this to the Moddesc.xml:
<axis name="MULDEHOCH" key1="KEY_j" key2="" key3="" key4="" button="" axis="AXIS_3" device="0" invert="false" />
i cant find the entry in the options.
Next problem, how to find out the value of the axis?
if i use "getInputAxis(integer axisNumber, integer gamepadIndex)" i need the setted values from the options. But how can i find them out?
|Stefan Geiger - GIANTS Software||15.08.2010 19:58|
|You should use different names for the button and the axis.
You can get the data of an axis with InputBinding.getAnalogInputAxis(InputBinding.xxx) and InputBinding.getDigitalInputAxis(InputBinding.xxx)
You need to use both to support both keyboard and gamepad input.
Normally you can use something like this:
local input = InputBinding.getAnalogInputAxis(InputBinding.xxx);
if InputBinding.isAxisZero(inputZ) then
input = InputBinding.getDigitalInputAxis(InputBinding.xxx);
Now you can use input to do your stuff. It is between -1 and 1.
You are however not limited to use the code above, you could also different handling for input that comes from an analog device (gamepad, joystick) and for input from a digital device (keyboard)
|Thomas H. (Patar)||15.08.2010 21:20|
|yes, but, i can't add the axis to the options?
Note: Log in to post. Create a new account here.