InputMapper and F310 Z-Axis

Hi, i am trying to learn lemur input mapping. I have a Logitech F310 gamepad and i run left, right and pov axis on inputMapper on X-Input mode. Also the z-axis LT and RT is working as L2 and R2 button on D-Input mode. But i did not find the Z axis constants on lemur.input.Axis for X-Input. What should i do?

First, verify that your joystick is working properly and see what it’s reporting for those by running the JME TestJoystick application.

It could be that it’s just not mapped in an expected way. (Edit: and note: JME allows mappings to be defined in a local joystick.properties file to correct this.)

Otherwise, I interpret your question in a few different ways and I’m not sure which way to answer… so more information may be helpful.

Thanks for be interested

Sure, those are my gamepad results while pushing RT and LT on TestJoystick (i hope you wanted this.)

For RT on X-Input:
.
.
Axis:Z Axis=-0.99612427
.
.

For LT on X-Input:
.
.
Axis:Z Axis=0.9726864
.
.

For RT on D-Input:
Button:7 state:1
Button:Düðme 7=Up
Button:7 state:0

For LT on D-Input:
Button:6 state:1
Button:Düðme 6=Up
Button:6 state:0

Lets talking about my purpose now. I have a InputSettings class which is writing the user inputs on a properties file and reading them for inputMapper.map() function. So it converts strings to Axis, Button, KeyInput constants or vice versa. The results are exactly what I want until now. The only problem is that Z axis.

If you want to see it here is a line on my properties file.

tooglePowerJ=Button[joystick_right1]&Button[joystick_left1]

my class is converting that line for inputMapper like this.

inputMapper.map(F_TOOGLEPOWER_J, Button.JOYSTICK_RIGHT1, Button.JOYSTICK_LEFT1);

that is my all information :slight_smile:

I’m sorry. I’m still not understanding what the actual problem is.

You press some input on the joystick. And it produces some output in the test joystick app. And that somehow isn’t mapped to a Lemur input?

This is how lemur maps a gamepad:

It could be that your joystick is not reporting “whatever” as the “whatever it’s supposed to”. I’m still not clear on “whatever” is and “whatever it’s supposed to is”.

the actual problem is i didnt find to mapping constant Z-Axis as know as Trigger axis, as known as RT-LT buttons for inputMapper.map() method in com.simsilica.lemur.input.Axis.class.

I mean,
Axis class contains;

JOYSTICK_X → I dont know what to this do on my gamepad.
JOYSTICK_Y → I dont know what to this do on my gamepad.

JOYSTICK_LEFT_X → Left Analog Stick X
JOYSTICK_LEFT_Y → Left Analog Stick Y

JOYSTICK_RIGHT_X-> Right Analog Stick X
JOYSTICK_RIGHT_Y-> Right Analog Stick Y

JOYSTICK_HAT_X → POV X axis buttons
JOYSTICK_HAT_Y → POV Y axis buttons

so what should be the Trigger buttons RT-LT ?

edit: more explanation

here is your mapping code axis part

joystickAxisMap.put(j.getXAxis(), Axis.JOYSTICK_LEFT_X); -> LEFT STICK
joystickAxisMap.put(j.getYAxis(), Axis.JOYSTICK_LEFT_Y); -> LEFT STICK
joystickAxisMap.put(j.getAxis(JoystickAxis.Z_AXIS), Axis.JOYSTICK_RIGHT_X); -> RIGHT STICK
joystickAxisMap.put(j.getAxis(JoystickAxis.Z_ROTATION), Axis.JOYSTICK_RIGHT_Y); -> RIGHT STICK
joystickAxisMap.put(j.getPovXAxis(), Axis.JOYSTICK_HAT_X); -> POV
joystickAxisMap.put(j.getPovYAxis(), Axis.JOYSTICK_HAT_Y); -> POV

where is the Trigger Axis mapping?

i think it must be a line like this if i am not mistaken;

joystickAxisMap.put(j.getAxis(“trigger”), Axis.JOYSTICK_Z);

The thing is, almost every gamepad will report axes diffrently, so even if you did assume triggers are Z axis, it wouldnt work with xbox based gamepads.

Are these the triggers on the front of the joystick?

If so then those should be mapped to one of the LEFT1, RIGHT1, LEFT2, RIGHT2, etc…

If they are not triggering those graphics in the test joystick app then you can remap them with a local joystick.properties file for that joystick. Then Lemur will see them as LEFT1, RIGHT1, whatever.

If this is not the trigger buttons on the front of the gamepad then can you find a picture online or something? Because if that’s the case I’m still having some trouble connecting the dots. Admittedly the problem is likely on my end because my head has been deep into something else for two weeks.

411ttd48gAL

The gamepad has two connection options. These are X-Input(xbox like) and D-Input(normal)

if i use the gamepad on D-Input connection, that buttons represented by Button.RIGHT2 and Button.LEFT2.

but the X-Input, that buttons represents by anything. Why? Because lemur has 6 axis mapping. There are

Axis.JOYSTICK_LEFT_X → LEFT STICK left and right
Axis.JOYSTICK_LEFT_Y → LEFT STICK up and down
Axis.JOYSTICK_RIGHT_X → RIGHT STICK left and right
Axis.JOYSTICK_RIGHT_Y → RIGHT STICK up and down
Axis.JOYSTICK_HAT_X → POV left and right
Axis.JOYSTICK_HAT_Y → POVup and down

but you see? there is nothing for Trigger axis. RT and LT buttons has a analog value on X-Input Mode not state like buttons. RT is negatif Z value and LT is positive Z value.

“Admittedly the problem is likely on my end because my head has been deep into something else for two weeks.”

I hope your issues are resolved in the way you want :slight_smile:

Ahah… I think it’s all clear to me now. This is an excellent explanation.

So can’t you just use that?

Mappings could probably be added. I think also maybe that the JME built-in remapping might let you map those to buttons again but I’m not sure. It could be no.

Lemur really wanted to present a standard minimal view which is probably why I didn’t add a way to easily add your own mappings. The idea was that if you have JME properly configured then your Lemur UI would always work as expected. That’s probably no excuse for not letting you map your own if you wanted to, though… and just know that it will maybe not work right for others.

As it is, if you want to customize the mapping then the only options are:

  1. modify Lemur code
  2. extend InputMapper and override the mapGamepad(Joystick j) method.
    …which then if you use standard lemur and not InputMapper on its own means that you have to extend GuiGlobals also, I think… Hmmm… no that won’t work either. If you are using GuiGlobals then it will always use the stock InputMapper.

I really need to add some mapping methods to InputMapper. If you are impatient then you can do it locally if you have Lemur checked out. If you use gradle/maven in your own project then it’s pretty easy. Just “gradle install” lemur locally and then your other builds will pick up your local version.

Yess. I did know lemur has missing mapping :smile: :smile:

Thanks for all answers.

By the way, @pspeed if you will let me, not because I’m impatient but i want create my own InputOrganizer based exactly like your InputMapper but indepented from GuiGlobals for learn in depth to input mecanism of JME and adding some new methods for my next use (and mappings sure :slightly_smiling_face:).

You can already use InputMapper 100% independent of GuiGlobals. It was a separate project before I pulled it into Lemur and that’s really the only touch point.

Essentially, you can use InputMapper on its own but GuiGlobals is a way of tying a bunch of useful stuff together. I mean, you are welcome to write your own but years of experience and two previous attempts went into InputMapper already. (And there is a push to bring it into JME core even.)

I see, infact, you are absolutly right. I love inputMapper mechanics already and there is no need to create a new inputmapper but i think there is no way to attach an single direction of axis to a FunctionID in Lemur InputMapper too. For example; i have two different function and the user wants to set POVY+ to one of them and POVY- to the other one. But there is no method to seperate POVY+ and POVY- from Axis.POVY in inputMapper. I mean if the user when pushed povy+ or povy-, inputMapper listeners catch only one axis to both of them and runs only first attached function id. Maybe lemur has this seperate function and i did not find this. If it hasnt, the inputMapper is not enough for user settings at least for gamepads.

I think that’s true but it’s because JME treats them like an axis, also. Treating them like buttons would require some kind of filtering… which could also be done in your listeners (but then you do lose the ability to easily remap them).

I don’t remember if joystick.properties lets you remap them to buttons or not… but I’m guessing not.

I’ll have to think about this some more.