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 );
}