JBullet MeshCollisionShape Problem

Dear guys,

I’m trying to use jbullet and I’ve some problem to set collision shapes. I need to set a mesh shape for my ground, so I’ve tried to import my model and to set a new MeshCollisionShape in different ways:

  • importing model from .3ds file
  • importing model from -jme.xml file
  • importing model from .jme file
  • importing model from .obj file



    when I try to create

    [java]new PhysicsNode(myNodeOrTriMesh, CollisionShape.ShapeTypes.MESH, 0);[/java]

    at runtime I get

    [java]java.lang.UnsupportedOperationException: No usable trimesh attached to this node![/java]



    so it cannot create Collision Mesh from my model, why? Only with .obj files I’ve not this problem, but I prefer not to use this kind of file.



    Are there some settings ore some useful conversion to get MeshCollisionShape correctly?



    Thanks :wink:

A movable model cannot have a mesh collision shape anyway. You have to specify a node that has a TriMesh as child to create a Mesh collision shape for static models.

Thanks, but what can I do for movable models? Is there a workaround?

With odejava in jmephysics2 I was able to get good mesh collision shapes without problems and without create custom TriMesh…

You can use the GImpact collision shape, which is a dynamic mesh shape, but as in odejava too, its not recommended to use these kind of shapes, a combination of simple collision shapes in a CompoundCollisionShape is the most performant solution. If you want to use them you should at least create a lowpoly version of your mesh and use that to create the physics collision shape.

Thank you very much, I’ll try it! :slight_smile: