How to bind to 2 keys (Shift+LeftMouse)?

Hi guys!

Simple question: How to bind to 2 keys (Shift+LeftMouse)? I did not find this in the docs.

Like this but with Shift:
[java]
inputManager.addMapping(“myAction”, new KeyTrigger(KeyInput.BUTTON_LEFT));
[/java]

Thank you.

With standard input manager, you have to do this yourself by setting up two triggers.

The InputMapper wrapper that I use in my stuff has support for this (among other things)… I’ve just been too lazy to check it into lemur.

@pspeed said: With standard input manager, you have to do this yourself by setting up two triggers.

The InputMapper wrapper that I use in my stuff has support for this (among other things)… I’ve just been too lazy to check it into lemur.


You meam something like this?:
[java]
boolean ac1 = false;
boolean ac2 = false;

inputManager.addMapping(“myAction1”, new KeyTrigger(KeyInput.BUTTON_LEFT));
inputManager.addMapping(“myAction2”, new KeyTrigger(KeyInput.KEY_SHIFT));

onAction(String name …) {
if (name.equals(“myAction1”)) ac1 = true;
if (name.equals(“myAction2”)) ac2 = true;

if (ac1 && ac2) doWhatIWant();
}
[/java]

Or there is another way to know if i pressed 2 keys?

You never unset the oc1 and oc2 but that’s essentially the “doing it yourself” way, yes.

Be aware that if you do it so, you will have the same behavior for

  1. shift + click
  2. click and then shift

But you’re right this is painful. The same goes for detecting click Vs press&drag…

not really used them, but they may help:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:combo_moves

1 Like