Error creating physics geometry

Hey guys,

I have a fairly complex model im trying to use as a "floor" in the engine. Its basically a piece of the city I live in… The model will load in the engine fine unless i call generatePhysicsGeometry on it. Then it will crash with the following error

com.jmex.physics.PhysicsNode createPhysicsGeometry
WARNING: Skipped geometry:
java.lang.IllegalArgumentException: Extent cannot have a component that is 0 to generate collision geometries!
   at com.jmex.physics.PhysicsNode.createPhysicsGeometry(
   at com.jmex.physics.PhysicsNode.generatePhysicsGeometry(
   at com.jmex.physics.PhysicsNode.addPhysicsGeometries(
   at com.jmex.physics.PhysicsNode.addPhysicsGeometries(
   at com.jmex.physics.PhysicsNode.addPhysicsGeometries(
   at com.jmex.physics.PhysicsNode.generatePhysicsGeometry(
   at com.jmex.physics.PhysicsNode.generatePhysicsGeometry(
   at com.jmex.physics.PhysicsNode.generatePhysicsGeometry(
   at com.jmex.physics.PhysicsNode.generatePhysicsGeometry(
   at RtsMain.simpleInitGame(
   at RtsMain.main(
Jun 2, 2008 3:20:40 PM class RtsMain start()
SEVERE: Exception in game loop
java.lang.IllegalArgumentException: scale must not have 0 as a component (geom 'Line185##0')!
   at com.jmex.physics.impl.ode.geometry.OdeBox.updateWorldVectors(
   at com.jme.scene.Spatial.updateWorldData(
   at com.jme.scene.Spatial.updateGeometricState(
   at com.jme.scene.Node.updateWorldData(
   at com.jme.scene.Spatial.updateGeometricState(
   at com.jmex.physics.impl.ode.OdePhysicsSpace.updateScene(
   at com.jmex.physics.impl.ode.OdePhysicsSpace.update(
   at com.jmex.physics.util.SimplePhysicsGame.update(
   at RtsMain.main(

What is wrong with my model that Jmonkey doesn't like? Any Ideas?

A Floor has no volume for Boundings, or is it a box?

for static stuff like terrain you can use generatePhysicsGeometry(true), for generating PolygonPhysics instead of Primitives, perhabs there the error doesn't come.

Good luck

it has a bounding box for boundings. I called generatePhysicsGeometry(true) but I get this error:

 An unexpected error has been detected by Java Runtime Environment:
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7d620f30, pid=1648, tid=2760
# Java VM: Java HotSpot(TM) Client VM (10.0-b19 mixed mode windows-x86)
# Problematic frame:
# C  [ntdll.dll+0x20f30]
# An error report file with more information is saved as:
# C:Documents and Settingsa.simonworkspaceSkylineRTSv2hs_err_pid1648.log
# If you would like to submit a bug report, please visit:
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.

[error occurred during error reporting , id 0xc0000005]

Thanks for the suggestion :)

I think i've found the problem with the model… It seems when there is an object in the model that is completely flat, like a plane, thats what the error is talking about "extent.x cannot be less than 0"…


So i have some weird things going on with this model. I think im giong to ask the model guys to fix it since i kind of hacked the engine code to make it work.

Heres the method i hacked a little bit… Basically told it for force the bounding box not to be zero and to just make it small.

 private PhysicsCollisionGeometry createPhysicsGeometry( BoundingBox box ) {
        if ( box.xExtent <= 0) {
           box.xExtent = 1;}
        if ( box.yExtent <= 0) {
           box.yExtent = 1;}
        if ( box.zExtent <= 0) {
           box.zExtent = 1;}
           // Logger.getLogger( PhysicsSpace.LOGGER_NAME ).log( Level.WARNING, "Skipped geometry:" ,
                    //new IllegalArgumentException( "Extent cannot have a component that is 0 to generate " +
                   // "collision geometries!" ) );
        PhysicsBox geom = createBox( null );
        geom.getLocalScale().set( box.xExtent * 2, box.yExtent * 2, box.zExtent * 2 );
        geom.getLocalTranslation().set( box.getCenter() );
        return geom;

Now the model actually works. I also had to call generatePhysicsGeometry(true) or else there would be no collisions at all... Driving my car on some parts of the model causes that weird access violation error...

Anyways, just thought i'd share with everyone!