I tried to to HelloCollision tutorial with a custom scene (3 simple meshes with 3 different textures). The default town.zip example loads and plays fine. However, when I try to replace town scene with my own I get this:
[java]SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
at java.nio.ByteBuffer.allocate(Unknown Source)
at java.lang.Thread.run(Unknown Source)[/java]
Which seems to be caused by the call to CollisionShapeFactory’s createMeshShape method in this:
[java] assetManager.registerLocator(“level.zip”, ZipLocator.class.getName());
sceneModel = assetManager.loadModel(“level.scene”);
// We set up collision detection for the scene by creating a
// compound collision shape and a static physics node with mass zero.
CollisionShape sceneShape = CollisionShapeFactory.createMeshShape((Node) sceneModel);[/java]
My scene loads and displays perfectly fine if I remove any code associated with collision detection (I am even able to fly around the scene and observe the model).
Any help is greatly appreciated!
Make sure your meshes only consist of triangles.
From the looks of it in jMP mesh only view there are triangles only (it’s a really simple mesh). Are you saying that some faces might be squares or there are loose vertices somewhere?
Yes, the physics will only work properly with triangle meshes. Rogue vertexes and strip fans etc. will make it go haywire.
Ok, the mesh is literally 2 triangles now (6 vertices). Still the same problem Also, submeshes consist of of faces, and each face only has 3 vertices. Where do loose vertices come from then?
Try making single MeshCollisionShapes from each mesh in the model and see which one fails.
Yep. Tried all that. Scene now includes one mesh only, which is just a triangle (3 vertices). Still same problem.
No, I mean don’t use the factory. How do you import your meshes? Blender 2.49 + OgreXML exporter that comes with jMP?
Nope. Blender 2.56a + blender2ogre 0.3.0.
Took me a while to actually get models to load in jMP first. (more here. That one was fixed REALLY fast. After you sent me the link to source code, I went to look in parser code only to find the fix was submitted an hour ago:)). Is there code example for single MeshCollisionShape usage?
Oh, well it might be theres a quirk in that import path that makes the mesh incompatible to jbullet (can happen even if the model displays fine in jME) Creating a MeshCollisionShape from a mesh is not so hard… new MeshCollisionShape(mesh)
RIght. But where do I get mesh object from? Can I create a mesh from my model?
To access a geometry in a loaded model, look at the structure in jMP and note the names of the geometry, then access like this:
Ugh… Looks like it didn’t like my mesh.xml schema. I had to reformat it to conform with the schema presented in town example. Should I even bother going further with Blender 2.56a + blender2ogre 0.3.0? Are there plans to make parsers account for different schemas?
The recommended import path is the one I mentioned, we will migrate/update to blender 2.5 and the corresponding export scripts when both are stable.
ok , i need somehelp from you
i’m new in this and i need u to tell me a hint or anything about how to make my own scene
ok , i need somehelp from you :D
i'm new in this and i need u to tell me a hint or anything about how to make my own scene :D
Did you test The Warlock?
It's incredibly handy....