Need Help with States

Hi, I recently got into jMonkeyEngine and I love it so far. I was trying to program different states when I came across this problem. I keep getting the error: “Incompatible types - Required: com.bulletphysics.collision.broadphase.Dbvt.Node Found: com.jme3.scene.Node” while trying to initialize the rootNode.

Here is my code:

Main Class
[jpackage mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.renderer.RenderManager;

public class Main extends SimpleApplication {

MainMenu MainMenu = new MainMenu();

public static void main(String[] args) {
    Main app = new Main();
    app.start();
}

@Override
public void simpleInitApp() {
    stateManager.attach(MainMenu);
}

@Override
public void simpleUpdate(float tpf) {
    //TODO: add update code
}

@Override
public void simpleRender(RenderManager rm) {
    //TODO: add render code
}

}]

MainMenu Class
[jpackage mygame;

import com.bulletphysics.collision.broadphase.Dbvt.Node;
import com.jme3.app.Application;
import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.asset.AssetManager;

public class MainMenu extends AbstractAppState {

private SimpleApplication app;

private Node rootNode;
private AssetManager assetManager;


@Override
public void initialize(AppStateManager stateManager, Application app) {
    super.initialize(stateManager, app);
    this.app = (SimpleApplication) app;
    
    this.rootNode = this.app.getRootNode(); // This is where the error is occuring
}

@Override
public void update(float tpf) {
    
}

@Override
public void cleanup() {
    
}    

}]

Any help would be appreciated. Thanks a lot!

[java]
import com.bulletphysics.collision.broadphase.Dbvt.Node;
[/java]

Try replacing this line with:
[java]
import com.jme3.scene.Node;
[/java]

Then read http://stackoverflow.com/questions/12620369/how-java-import-works

1 Like

Really appreciate the help! Thanks a lot!

2 Likes

Also, for the future:

Yea, I figured it out. I thought you just had to hit it once and paste your code in the square brackets. Thanks though!

@TheBlueDragon said: Yea, I figured it out. I thought you just had to hit it once and paste your code in the square brackets. Thanks though!

If you already have code pasted in then I think you can select it and hit the button and it will bracket it. Otherwise, you have to hit it once for the beginning and then again for the end.