[SOLVED] How to use input system to control multiple objects

Hi this might be a very beginner level question but I’m stuck at it.Here’s my question:
in Jmonkey’s beginner tutorial e.Hello Input it showed how to control the character(a box) using custom key
binding.And the codes look like these:

private AnalogListener analogListener = new AnalogListener() {
public void onAnalog(String name, float value, float tpf) {
if (isRunning) {
if (name.equals(“Rotate”)) {
player.rotate(0, valuespeed, 0);
}
if (name.equals(“Right”)) {
Vector3f v = player.getLocalTranslation();
player.setLocalTranslation(v.x + value
speed, v.y, v.z);
}

I wonder how can I choose between different objects I have in scene using input key?
i.e hit 1 to choose node1 and control it.
hit 2 to choose node 2 etc etc.

Thanks for reading these and I really appreciate some help!

Hi,
I had at some point the same problem. Here is link to my old thread. Maybe that could help you: Controling Vehicles

Thank you so much Teemo,
your reply inspired me much!

1 Like