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