Slightly changed TestVehicle --> program crashes


I changed TestVehicle a bit to not only have wireframes but solid models but now the program crashes - not only an exception but a crash with the following error message:

An unexpected error has been detected by HotSpot Virtual Machine:


Your program feeds ODE with values it can't handle. ODE crashes in this case.

To narrow things down apply those alterations step by step and have a look which change exactly causes this. If you find out please post it here so other know what was wrong and maybe I can put a check into jME Physics that reports the error instead of crashing.

I only changed the createFloor() method to:

final StaticPhysicsNode terrain = getPhysicsSpace().createStaticNode();


      PhysicsMesh terrainmesh = terrain.createMesh( "terrain mesh" );

      Box terrainbox=new Box("Terrain Box",new Vector3f(-10,0,-10),new Vector3f(15,0.1f,15));


      terrainmesh.copyFrom( terrainbox );

      terrainbox.setModelBound( new BoundingBox() );





Is there anything wrong?

remove that line (it does not even make sense):


Fine, thank you. Now I wanted also to have solid wheels. I wrote into the loop:

PhysicsMesh tiremesh = tire.createMesh( "sphere mesh" );

          Sphere tiresphere=new Sphere("Tire Sphere",10,10,1f);

          tiremesh.copyFrom( tiresphere );

          tiresphere.setModelBound( new BoundingSphere() );

            tire.getLocalTranslation().set( ( 0.5f - ( i & 1 ) ), 0, ( 1 - ( i & 2 ) ) * 0.5f );

            tire.setMaterial( Material.RUBBER );


            tire.setMass( 50 );

            rootNode.attachChild( tire );

Now I get about 1 fps so there is even the message "Maximum physics update interval is 1 second - capped." - I first thought that there are too much triangles but I don't believe this because there were not less with the capsule tires of Testvehicle.

You shouldn't make all the stuff with triangle colliders, really. Have a look into TestGenerateGeometry to learn how you can have visuals without triangle colliders.

(I still wonder why it gets that slow - seems all those constantly colliding physics meshes could be too much for ODE)

Ok, looks like it works but now the axis to rotate the wheels is in wrong place. It is near my chassis although joint.setAnchor( tire.getLocalTranslation() ); is set. I can turn the wheels perfectly but if I hold the car in the air (with the "debug joint" from TestVehicle) and accelerate, the wheels swing fore and back because the rotation axis is too high.

I think I got the reason: I testet it again with TestVehicle and noticed that the wheel-rotation axis is always set by the chassis - but why???

How can I set this axis to the wheels (which would be much more clever)?

hehe, gratz :slight_smile:

I have a solution: I set the center of the box a bit higher and the DynamicPhysicsNode stayed at 0,0,0 - now the chassis box is above the wheels and the axis is in the center of the wheels - yeah, I found a solution myself, I'm so proud

The axes are relative to the first attached node by default. You can change that per axis with setRelativeToSecondObject. The current implementation (ODE) does support only the mode seen in TestVehicle, though. So you can only do it like in TestVehicle.

Why do you think something else would be more clever?