hi
i’m having a little problem with my project , i’m doing a driving skill project , & the problem is with the car model , that’s the link to the model Car Model , when i run the application , the car position is like that and it still like that and never fall to the ground !
that is my code for the car [java] private void buildCar() {
float stiffness = 200f;//200=f1 car
float compValue = 0.5f;//(lower than damp!)
float dampValue = 0.4f;
float wheelRadius = 0.63f;
final float mass = 1000;
float restLength = 0.1f;
Geometry mychasis;
//Load model and get chassis Geometry
mycarNode = new Node ("mycarNode");
Node chasisNode = new Node ("chasisCar");
mychasis = (Geometry) assetManager.loadModel("Models/Vehicles/nimrud/nimrud.obj");
mychasis.setLocalTranslation(0, 0, 0);
chasisNode.attachChild(mychasis);
mycarNode.attachChild(chasisNode);
//Create a hull collision shape for the chassis
CollisionShape carHull = CollisionShapeFactory.createDynamicMeshShape(mychasis);
//Create a vehicle control
vehicle = new VehicleControl(carHull, mass);
mycarNode.addControl(vehicle);
//Setting default values for wheels
vehicle.setSuspensionCompression(compValue * 2.0f * FastMath.sqrt(stiffness));
vehicle.setSuspensionDamping(dampValue * 2.0f * FastMath.sqrt(stiffness));
vehicle.setSuspensionStiffness(stiffness);
vehicle.setMaxSuspensionForce(100000000);
//Create four wheels and add them at their locations
//note that our fancy car actually goes backwards..
Vector3f wheelDirection = new Vector3f(0, 0, -1);
Vector3f wheelAxle = new Vector3f(-1,0, 0);
Node node_fr = new Node ("wheel_fr");
Geometry wheel_fr = (Geometry)assetManager.loadModel("Models/Vehicles/nimrud/wheel.obj");
wheel_fr.scale(0.022f, 0.022f, 0.022f);
node_fr.attachChild(wheel_fr);
vehicle.addWheel(node_fr, new Vector3f (1.5f,2.85f,-0.01f),
wheelDirection, wheelAxle, restLength, wheelRadius, true);
Node node_fl = new Node ("wheel_fl");
Geometry wheel_fl = (Geometry)assetManager.loadModel("Models/Vehicles/nimrud/wheel.obj");
wheel_fl.scale(0.022f, 0.022f, 0.022f);
node_fl.attachChild(wheel_fl);
vehicle.addWheel(node_fl, new Vector3f (-1.5f, 2.85f,-0.01f),
wheelDirection, wheelAxle, restLength, wheelRadius, true);
Node node_br = new Node ("wheel_br");
Geometry wheel_br = (Geometry)assetManager.loadModel("Models/Vehicles/nimrud/wheel.obj");
wheel_br.scale(0.022f, 0.022f, 0.022f);
node_br.attachChild(wheel_br);
vehicle.addWheel(node_br, new Vector3f(1.5f, -2.3f, -0.01f),
wheelDirection, wheelAxle, restLength, wheelRadius, false);
Node node_bl = new Node ("wheel_bl");
Geometry wheel_bl = (Geometry)assetManager.loadModel("Models/Vehicles/nimrud/wheel.obj");
wheel_bl.scale(0.022f, 0.022f, 0.022f);
node_bl.attachChild(wheel_bl);
vehicle.addWheel(node_bl, new Vector3f (-1.5f, -2.3f, -0.01f),
wheelDirection, wheelAxle, restLength, wheelRadius, false);
mycarNode.attachChild(node_fr);
mycarNode.attachChild(node_fl);
mycarNode.attachChild(node_br);
mycarNode.attachChild(node_bl);
vehicle.getWheel(0).setFrictionSlip(10);
vehicle.getWheel(1).setFrictionSlip(10);
vehicle.getWheel(2).setFrictionSlip(10);
vehicle.getWheel(3).setFrictionSlip(10);
//rootNode.attachChild(chasisNode);
rootNode.attachChild(mycarNode);
getPhysicsSpace().add(vehicle);
}[/java]