VehicleControl, car keeps going through the plane

[java] setMaxSuspensionForce [/java]
ive set this value to the max float value still goes through the plane. im using the testphysicscar code but how ever i change the stiffness or whatever it keeps bouncing alot. straight line works its the turning that the wheels all of the sudden goes through

Don’t use a large box as surface, read the javadoc of the suspension methods.

1 Like

im useing a plane. thought it could be some common problem i will post code if you need.

[java]
scene = assetManager.loadModel(“Scenes/MainScene.j3o”);
CollisionShape map = CollisionShapeFactory.createMeshShape(scene);
floorPlane = new RigidBodyControl(map, 0);
Node mapNode = new Node(“map node”);
mapNode.addControl(floorPlane);
mapNode.attachChild(scene);
getPhysicsSpace().add(mapNode);
rootNode.attachChild(mapNode);
[/java]

[java]
cubeModel = assetManager.loadModel(“Models/cube/cube.j3o”);
characterNode = new Node(“player node”);
CollisionShape carHull = CollisionShapeFactory.createDynamicMeshShape(cubeModel);
CompoundCollisionShape compoundShape = new CompoundCollisionShape();
compoundShape.addChildShape(carHull, new Vector3f(0f,2f,0f));

    player = new VehicleControl(compoundShape, 400f);
    characterNode.addControl(player);
    characterNode.attachChild(cubeModel);

[/java]

what im notecing is that yOff is positioning the carHull shape in the world.
[java]
//Create four wheels and add them at their locations
Vector3f wheelDirection = new Vector3f(0f, -1f, 0f); // was 0, -1, 0
Vector3f wheelAxle = new Vector3f(-1f, 0f, 0f); // was -1, 0, 0
float radius = 1f;
float restLength = 0.3f;
float yOff = -.5f;
float xOff = 2f;
float zOff = 3f;
[/java]

the best performance is when dampvalue and that other value are 0.1 both. still very shaky. and why does the debugger throw a exception at the plane code? works without it.

@Ben255 said: im useing a plane. thought it could be some common problem i will post code if you need.

[java]
scene = assetManager.loadModel(“Scenes/MainScene.j3o”);
CollisionShape map = CollisionShapeFactory.createMeshShape(scene);
floorPlane = new RigidBodyControl(map, 0);
[/java]

@normen said: Don't use a large box as surface, read the javadoc of the suspension methods.

@Ben255 you are kind of splitting hairs to suggest that a plane is different than a box in this case. The point is: if you have very large triangles relative to your car’s size then you will have issues. So we’ll all just assume that your 'MainScene.j3o" is just two giant triangles or something.

1 Like

okay, dont fully understand what you guys mean yet but i will ponder thanks ^^

@Ben255 said: okay, dont fully understand what you guys mean yet but i will ponder thanks ^^

Let us know if it is still unclear.

1 Like

aha, yes. but when i run the test carphysics with the debugger its using one box as plane. also is there a example program that explains this?(how to implement it)
thanks.

this didnt change anything about the car :s still bouncing and stuff
[java]
scene = assetManager.loadModel(“Scenes/MainScene.j3o”);
Geometry sceneGeo = findGeom(scene,“terrain-MainScene”);
terrain = new TerrainQuad(“terrain”, 65, 513, null);
terrainControl = new TerrainLodControl(terrain, getCamera());
terrainControl.setLodCalculator(new DistanceLodCalculator(65, 2.7f) );
terrain.addControl(terrainControl);
terrain.setMaterial(sceneGeo.getMaterial());
rootNode.attachChild(terrain);
floorPlane = new RigidBodyControl(0);
terrain.addControl(floorPlane);
getPhysicsSpace().addAll(terrain);
[/java]

i have not placed the car model in the MainScene tho, is that mandatory?.(lol nvm)

okay, im a retard :p. the cars box was not all the way out to the wheels so when turning that kinda screwd it all up :smiley: