Hello everyone,
Im new and trying to use Application class by extending it. I tried to create a flycam the same as it is created in SimpleApplication class. Problem is it didnt work and doest respond on my nifty gui menu… The nifty gui menu is working when used in a simple application subclass. I think I miss something here.
Please look at my code, the flycam is created in the initialize method. And i think should work fine but it did not work. As you can see in the code i created a box in the center to test if i can use the WASD , it did not work too… please enlighten me what im missing here…
thanks
[java]public class Salipawpaw extends Application {
protected FlyByCamera flyCam;
Geometry boxGeom;
public static void main(String[] args) {
Salipawpaw app = new Salipawpaw();
app.start();
}
@Override
public void start() {
AppSettings appSettings = new AppSettings(true);
appSettings.setResolution(800, 600);
setSettings(appSettings);
super.start();
}
@Override
public void initialize() {
super.initialize();
flyCam = new FlyByCamera(cam);
flyCam.setMoveSpeed(5);
flyCam.registerWithInput(inputManager);
flyCam.setDragToRotate(true);
flyCam.setEnabled(true);
Box box = new Box(Vector3f.ZERO, 1, 1, 1);
boxGeom = new Geometry(“My monkey box”, box);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);
mat.setColor(“m_Color”, ColorRGBA.Blue);
boxGeom.setMaterial(mat);
viewPort.attachScene(boxGeom);
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, viewPort);
Nifty nifty = niftyDisplay.getNifty();
nifty.fromXml(“Interface/salipawpaw.xml”, “screenMain”, new MainMenuController(this));
guiViewPort.addProcessor(niftyDisplay);
}
@Override
public void update() {
if(speed==0 || paused)
return;
float tpf = timer.getTimePerFrame() * speed;
stateManager.update(tpf);
boxGeom.updateLogicalState(tpf);
boxGeom.updateGeometricState();
stateManager.render(renderManager);
renderManager.render(tpf);
stateManager.postRender();
}
}[/java]
solve it… i just forgot to call super.update()