Vehicle Rolling

This is probably a question for normen. How do i stop the fancy car from rolling over if i increase the frictionslip? With a frictionslip of 0.8 the car becomes pretty unresponsive at speed. You commented:


 
 /**
     * reduces the rolling torque applied from the wheels that cause the vehicle to roll over.
     * This is a bit of a hack, but it's quite effective. 0.0 = no roll, 1.0 = physical behaviour.
     * If m_frictionSlip is too high, you'll need to reduce this to stop the vehicle rolling over.
     * You should also try lowering the vehicle's centre of mass
     */



I set all the wheels rollinfluence to 0 but the cars behavior doesnt change.

How do i lower the center of mass?

Really appreciate any help.

Lower the center of mass: http://code.google.com/p/jbullet-jme/wiki/CenterOfMass



Edit: btw, most of the info in the javadocs is from this excellent document about the native bullet by the madagscar kartz developer.

hey norm thanks but i cant get it working correctly. Its fine as long as i don't increase the friction slip. I tried the CompoundCollisionShape method but it causes the car to shake like its getting stuck in the ground for a split second every second which means the car cant pickup speed.



I'm trying to get a highly responsive car even at high speeds like a gocart and no drifting. Have you tried anything like this?

I don’t want to make another thread, so I am making reply here.

I am currently experiecing difficulty to make my car stable when steering in higher speeds with new model (old ferrari was fine, I guess because it is relatively low places car).
I tried shifting down the centre of mass from link normen posted, but I assume it is for JME2.
I can’t find any class PhysicsNode in JME3 and don’t know what is suitable replacement.
Without it I just end up with collision mesh shifted up.

[java] //Load model and get chassis Geometry
carNode = (Node)assetManager.loadModel(“Models/felicia.j3o”);

    carNode.setShadowMode(ShadowMode.CastAndReceive);
    Geometry chasis = findGeom(carNode, "Car");
    
  
    //Create a hull collision shape for the chassis
    CompoundCollisionShape compoundCollisionShape=new CompoundCollisionShape();
    CollisionShape boxCollisionShape=new CollisionShapeFactory().createDynamicMeshShape(chasis);
    compoundCollisionShape.addChildShape(boxCollisionShape, new Vector3f(0,1,0));
    CollisionShape carHull = compoundCollisionShape;
    carNode.setLocalTranslation(0,1,0);
    //PhysicsNode pNode=new PhysicsNode(mesh, compoundCollisionShape);
   
    
    //Create a vehicle control
    player = new VehicleControl(carHull, mass);[/java] 

I am new to programming other than console programming in C langauge, so sorry for my amateur questions.

The center of mass for the collision shape is at the center of the Spatial you supply to the collision shape factory if you use that. So you can just do something like this (pseudo code)
[java]
Node myNode = new Node(“Center Of Mass”);
Spatial car = assetManager.loadAsset(“Models/MyCar.j3o”);
//attach car to node
myNode.attachChild(car);
//moving the car up so that the center goes down in relation to the car geometry
car.setLocalTranslation(0,1,0);
CollisionShape shape = CollisionShapeFactory.createCollisionShape(myNode);
VehicleControl control = new VehicleControl(shape);
myNode.addControl(control);
[/java]

1 Like

Thank you normen, you led me to the right path.