Where To Find Tutorial In How To Load a Scene In The SimpleApplication main program

Hi,

I am just started using JME3.

Can anyone point me to where I can find documentation of how to load scenes.

I am aware of the TerraMonkey editor, and I want to create some scenes, but I don’t know how to load them into my program.

assetManager.loadModel(“Scenes/MyScene.j3o”);

http://wiki.jmonkeyengine.org/doku.php/jme3:beginner

This is what I got on my simpleInitApp() method:

    flyCam.setEnabled(false);

    Spatial myScene = assetManager.loadModel("Scenes/myTerrainScene.j3o");
  
    myCam = new RtsCam(RtsCam.UpVector.Y_UP);

    stateManager.attach(myCam);

    **CollisionShape sceneShape = CollisionShapeFactory.createMeshShape((Node)myScene);
    landscape = new RigidBodyControl(sceneShape, 0);**
    myScene.addControl(landscape);

    rootNode.attachChild(myScene);

what’s between ** ** seems to have an error that I cannot figure out… any thoughts on this?

The RtsCam works, that’s not the problem…the problem seems converting the Spatial into a CollisionShape and then making that into a rigidbodycontrol is not working either.

Well, then here is a solution.

Come on…

I don’t know why the IDE is highlighting those two lines red…it keeps telling me that there is no contructor for CollisionShape that can take the node (Node) myScene.

You didn’t tell us any of that before. You only said “there is an error”… which is only maybe 2% of the information we’d need to help.

And even the error you tell us can’t be right because there is no CollisionShape being constructed in that code.

I found the error.

It had to do with the import library…I was using the wrong import…anyhow. Thanks.

Glad you got it worked out.

Helpful advice for the future: next time you think to write about an error you are having… don’t bother unless you will actually include the information about the error. We can’t do anything with it otherwise and it saves a lot of useless back-and-forth.

Now that I have added the collision shape…how do you make the camera NOT go through the terrain?

First I need to figure out how to place the cam above the highest point of the terrain, and then make it so that it does not go through.

Which makes me look more silly now, since I added RigidBodyControl for no point because that does not make the camera solid.

I think you should probably play more with the tutorials before building your project. Really, the time spent on the tutorial is time saved when developing.

Not to mention that you will go “whoa, didn’t even imagine that I could do THAT!”, instead of going “Damn, I just want to do this. Why don’t you do it?” :wink: