I tried to use the beginner´s tutorial “Hello Collision” which worked fine. By the way, I completed all beginner´s tutorials. But now after I discovered the SceneComposer, TerrainEditor and stuff like that, I would like to exchange the town.zip scene mentioned in the tutorial with my own created, simple scene.
The first try, creating an empty project and adding my scene in the basic project worked fine. Then I used the above mentioned Tutorial class, changed from zip loading to the assetManager.load … Method to load my scene. And this led to the following exception:
Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IndexOutOfBoundsException: 8465
at java.nio.DirectIntBufferU.get(DirectIntBufferU.java:212)
at com.jme3.scene.mesh.IndexIntBuffer.get(IndexIntBuffer.java:52)
at com.jme3.bullet.util.Converter.convert(Converter.java:248)
at com.jme3.bullet.collision.shapes.MeshCollisionShape.createCollisionMesh(MeshCollisionShape.java:70)
at com.jme3.bullet.collision.shapes.MeshCollisionShape.(MeshCollisionShape.java:65)
at com.jme3.bullet.util.CollisionShapeFactory.createSingleMeshShape(CollisionShapeFactory.java:174)
at com.jme3.bullet.util.CollisionShapeFactory.createCompoundShape(CollisionShapeFactory.java:65)
at com.jme3.bullet.util.CollisionShapeFactory.createCompoundShape(CollisionShapeFactory.java:62)
at com.jme3.bullet.util.CollisionShapeFactory.createCompoundShape(CollisionShapeFactory.java:85)
at com.jme3.bullet.util.CollisionShapeFactory.createMeshCompoundShape(CollisionShapeFactory.java:94)
at com.jme3.bullet.util.CollisionShapeFactory.createMeshShape(CollisionShapeFactory.java:134)
at mygame.Main.simpleInitApp(Main.java:54)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:218)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:138)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:206)
at java.lang.Thread.run(Thread.java:662)
I am wondering how a minimal scene has to be created correctly. My structure right now is just:
- New scene
+ terrain-newScene
+ terrain-newScenePatch1
+ terrain-newScenePatch2
+ terrain-newScenePatch3
+ terrain-newScenePatch4
+ PhysicsControl
+ DirectionalLight
could it be that the floor must not be simply flat? maybe i have to make it somehow solid ? its has no height, it´s just the generated flat floor with a different texture.
ok now i understood. thx. trying to change the CollisionShapeFactory call for the first. but one question stays, can the SDK also be used to create meshes? how can i proceed from the plane to a mesh? is there a tutorial, a tool or a tip from your side? … thanks norman your support is really great. hope i can give some time back later when i am more experienced with the sdk.
Oh, the “plane” you created was done with the terrain editor and you try to create a collision shape for that? Thats a little different, you would need to call the createCollisionShape on the actual Terrain geometry. However, you can create rigidbody and collision shape right in the editor and simply load them alongside with the model:
normen said:
Oh, the "plane" you created was done with the terrain editor and you try to create a collision shape for that? Thats a little different, you would need to call the createCollisionShape on the actual Terrain geometry.
Thanks for your help again. I managed to get a running example with a geometry box where I can stand on and run in different directions. And I also can see the flat terrain I created with the terrain editor. But the collision detection doesn´t work with that terrain so far, it only works for my geometry box where I stand on.
Now I would like to know, is it possible (tried searching in the tutorials, but didn´t yet find the right one) to create and manipulate geometry spatials with the SDK, too? To fully use it as "level editor"? Your posted video shows how to change surface textures, but it doesn´t show collision detection. Has the texture you chose also effect on collision detection? I don´t think so far. I have to say that I am not using the demo textures, but simple jpg test images and load them via my assetManager. Maybe the demo textures have more informations stored in the jar file (for example collision or the animated stuff seen in the video).
normen said:
Just create them using e.g. blender and then import the model, apply a collision shape and fly :)
I have someone who takes the part of working with blender and creating models. But I can´t imagine the whole level will only be imported models. So the question remains wether it is possible to create spatial geometry objects via visual Editor in SDK or wether I have to do it programmatically.
Please read the documentation. You can combine mesh parts in a scene, yes. But the parts will have to be generated in an editor. Why exactly cant you imagine that the whole level is just imported models? Its like that in about 99.9% of all FPS games…
@normen got one last tip for me on that topic? because i already managed doing some of my model imports (some others fail unfortunately) and could also manage collision detection for geom objects. but the collision detection for my imported models doesnt work. tried several options with blender ogre export (static rigid, …) and tried different stuff in the jmonkey code. but i am still missing something. soooory to bother you. but at least you can see i am really hard interested in going on and i keep trying i LOVE the engine so far. but its not easy to start so far i only developed with javaEE webstuff (jsf, ejb, …).
The initScene is loading the j3o fine and it gets shown (even if i have to handle the textures again, because the ogre import doesnt import textured models). But i keep falling through the model.