Car fall's through terrain, wheels stay ontop

Well im working with JME Physics 2 and i was trying out the vehicle demo. I basically copy and pasted alot of code, but for some reason, my vehicle just won't stay ontop on the terrain.



It stays on for a bit then all falls down.



I run the physics debugger and i see some huge yellow lines point up and away, what do they represent? what force is making them want to point up?



Also the joints between the wheels and chassis get strung out really far apart, even though the min and max are set, what am i doing wrong?



      final DynamicPhysicsNode chassis = physicsSpace.createDynamicNode();
      chassis.createBox( "chassis" );
       chassis.setLocalScale( new Vector3f( 1, 0.1f, 1 ) );
       chassis.setLocalTranslation(new Vector3f(20,tb.getHeight(20f,20f),20) );
       scene.attachChild( chassis );
      
       for ( int i = 0; i < 4; i++ ) {
           DynamicPhysicsNode tire = physicsSpace.createDynamicNode();
           tire.createCapsule( "tire geom" );
           tire.setMaterial( Material.RUBBER );
           tire.setLocalScale( 0.3f );
           tire.getLocalTranslation().set( ( 0.5f - ( i & 1 ) )+20, 5, (( 1 - ( i & 2 ) ) * 0.5f) + 20);
           tire.computeMass();
           tire.setMass( 100 );
           scene.attachChild( tire );

           Joint joint = physicsSpace.createJoint();
           joint.attach( chassis, tire );
           joint.setAnchor( tire.getLocalTranslation() );
           final JointAxis axis1 = joint.createRotationalAxis();
           axis1.setDirection( new Vector3f( 0, 1, 0 ) );
           axis1.setPositionMinimum( -0.5f );
           axis1.setPositionMaximum( 0.5f );
           axis1.setAvailableAcceleration( 100 );
           axis1.setDesiredVelocity( 0 );
           final JointAxis axis2 = joint.createRotationalAxis();
           axis2.setDirection( new Vector3f( 0, 0, 1 ) );
           axis2.setAvailableAcceleration( 100 );
           axis2.setRelativeToSecondObject( true );
       }

did you make the terrain a StaticPhysicsNode ?

yup, i did that part



well, i fixed the issue with the falling: When the parts of the vehicle were created they were colliding with the terrain, causing them to just go right through



but now i realized that my joints between wheel and chasis, well just doesn't exist, any clues to why?

your joints look like they havent been changed from the testvehicle example, what makes you think they dont exist? are the wheels not attached to chassis?

exactly

try taking out this line

chassis.setLocalTranslation(new Vector3f(20,tb.getHeight(20f,20f),20) );

i removed that line, then translated the terrain, so that there would be a place for the car, no luck, same problem, thanks for trying though!!

no prob, one last thing though the line

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

causes some stange behavior here combined with the chassis translation, try the original line

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

may help your prob, may not :expressionless: what happens in my example is the joints are so far away the chassis goes past the ground and the wheels stay on top. the long yellow lines in physics debugging mode are the joints

oh, i see what your savying, its just that i needed to tranlsate the wheels with the chassis,I'm guessing this is where i went wrong? How else can i put the wheels near the chasis?

Will it work if i first connect everything then translate the chasis? Will the wheels coming along too?, I guess only 1 way to find out!



Thanks mud!



edit: so i removed the +20's in the translations, and i get this error


ODE Message 2: vector has zero size (c:eigene dateienjavagamedevelopmentode-unstableodesrcodemath.cpp:129)