Make spatial global

Hi there. Im new to jme so is there any way to make spatial “tank” global? I need to give a direction however jme says “cannot find symbol”
Here’s some part of my code

 public void simpleInitApp() {      
  Spatial tank = assetManager.loadModel("Models/untitled123.blend");
  tank.setLocalTranslation(-5.0f,4f,0.0f);
  tank.scale(2f, 2f, 2f);
  rootNode.attachChild(tank);
}

private AnalogListener analogListener = new AnalogListener() {
  @Override
public void onAnalog(String name, float value, float tpf) {
  if (isRunning) {
      speed = 5; 




}
    if (name.equals("Right")) { // Si la touche D=1
      v = tank.getLocalTranslation();
      Quaternion roll45 = new Quaternion();
      roll45.fromAngleAxis(-FastMath.QUARTER_PI,Vector3f.UNIT_Y);
      v = roll45.mult(v);
      tank.setLocalTranslation(v);
      
    }
    if (name.equals("Left")) {
      v = tank.getLocalTranslation();
      Quaternion rol45 = new Quaternion();
      rol45.fromAngleAxis(FastMath.QUARTER_PI,Vector3f.UNIT_Y);
      v = rol45.mult(v);
     tank.setLocalTranslation(v);
      
    }
    if (name.equals("Avant")) {
      v = tank.getParent().getLocalTranslation()
      tank.setLocalTranslation(v.x , v.y , v.z - value*speed);
      

    }
    if (name.equals("Arrière")) {
      v = tank.getLocalTranslation();
      tank.setLocalTranslation(v.x , v.y , v.z + value*speed);
     
    }
  }

Thanks in advance

Are you trying to access ‘tank’ inside ‘onAnalog’ ?
I would recommend you to learn basics about programming, classes, members etc.

This isn’t really a JME question but a Java-beginner question.

You’ve defined “tank” only in that method so that’s the only place you can use it. Basic language scope stuff.

You might consider doing some simple Java tutorials before branching into more advanced stuff. It will probably save you a bunch of time and let you have lots of Java documentation easy to hand.