Attaching to staticNode

Regarding your initial error (extent 0), I have found that the problem could happen when you try to generate physics geometry for objects that are infinitely thin (planes), for which an AABB would generate a Bounding Box with a 0 extent.



I make sure every node contains geometry with actual "volume" before generating geometry.



I hope that helps.

hmm even with

 BoundingBox bounds = new BoundingBox(        converter.getRoot().getLocalScale()
, 100.0f,100.0f,100.0f);
      converter.getRoot().setModelBound(bounds);
      converter.getRoot().updateModelBound();


it still returns the error


System.out.println(((BoundingBox)converter.getRoot().getWorldBound()).xExtent);
        System.out.println(((BoundingBox)converter.getRoot().getWorldBound()).yExtent);
        System.out.println(((BoundingBox)converter.getRoot().getWorldBound()).zExtent);


returns          x= 68.16
                      y=19.92
                      z=36.48


About Bounding Volumes



Calling .updateModelBound() will recalculate the Bounding Volume extents from the actual geometry contained in that node.



Look at the updateModelBound and setModelBoud code for Node:



    @Override
    public void setModelBound(BoundingVolume modelBound) {
        if(children != null) {
            for(int i = 0, max = children.size(); i < max; i++) {
                children.get(i).setModelBound(modelBound != null ? modelBound.clone(null) : null);
            }
        }
    }

    @Override
    public void updateModelBound() {
        if(children != null) {
            for(int i = 0, max = children.size(); i < max; i++) {
                children.get(i).updateModelBound();
            }
        }
    }



What you do on a Node is to update all children, or to set all children, but there is no Bound volume associated to a Node. On the other hand, updating a ModelBound on a Trimesh causes it to be recomputed from its Geometry.

Therefore, no matter what you set on the constructor, the model bound will be recalculated.

This also arises a question: can a Node have a Bounding Box? No. In fact, they don't even have a "bound" field, and calls to Node.setModelBound or node.updateModelBound are delegated to the Node's children.

WorldBounds are a different story. These bound volumes are the ones that are actually used for frustrum culling and collision testing. Every Spatial has one (and both Nodes and Geometries are Spatials).

Checking your Bound volumes if you need to

In any case, you should be able to walk recursively through all your scene graph and check all extents (for both ModelBounds and WorldBounds). Providing all of them are positive, if any of them is below a certain value (i.e. Float.MIN_VALUE or Float.MIN_VALUE * 2) you should try to remove that element from the scene graph and check if that solves the Exception you are seeing.

This will tell you if every geometry and node has some "volume".

About generatePhysicsGeometry and the extent issue

The code I have for this is slightly different from yours. When I need to generate Physics Geometry (and remember you may also wish to define it manually for some complex shapes), I use:

physicsNode.updateGeometricState(0, true);
physicsNode.generatePhysicsGeometry(true);

This will create PhysicsGeometry for your node and set everything up.

Now, the key here is the "true" parameter in the call to generatePhysicsGeometry. If you use true, you pass to ODE the list of triangles of your geometry. ODE will happily deal with this, and all your triangles will be collidable (this may be very expensive).

If you use false, jmePhysics will generate ODE primitives (there are some caveats here and some unimplemented primitives too). My understanding (never made proper tests) is that if any extent is zero, ODE will fail at runtime showing the exception you see.

Empty leaf nodes (with no geometry attached) may also fail as they have no extent. Maybe these ones are pruned by jmePhysics, but I'm not sure about this as I never checked it.

I hope this helps.

Please correct if you find something wrong

thx  jjmontes for the reply I've been attempting to fix the issue for a while now, I've really been unable to test other bsp maps because the particular map I use is that given in the bsp library. I've read your reply and it makes perfect sense except that i'm unsure if the below order would work because I believe i've tried something in a similar fashion however when i'm able to test it at home i'll try again. I have realized that Its sometimes able to run when i added the true boolean to the method however it still gave issues maybe it was where i put it in the method in the code.


physicsNode.updateGeometricState(0, true);
physicsNode.generatePhysicsGeometry(true);



thx for the info on Nodes
but just for clarity though would such compute the bounds from the child and give to the constructor?


modelformat paul = new modelformat;
Node char = new Node("char");
char.attachChild("paul");
Boundingbox bbox =(BoundingBox)char.getWorldBound()

I now recieve an error message titled ODE internal error 1

which says

ODE INTERNAL ERROR 1 wrote:


assertion "(g1>gflags_AABB_Bad==0" failed in c:eigene
dateienjavagamedevelopmentodejavaodejava-jnisrccollision_space_internal:h51


as well as another box saying runtime error which is because i don't have cleanup set up

hmm did i misinterpret your post ?