PhysicsVehicleWheel and friction


I’ve been playing a bit with the TestPhysicsCar from jme3test.bullet.

Is there any friction calculated by jbullet for the wheels? If I accelerate the car it doesn’t slow down, it just rolls as if there was no rolling friction.

I tried to figure out, if I can change this behaviour by setting the friction of the floor. I tried


//in setupFloor()

tb = new PhysicsNode …

/* … */



but that had no influence.

If I call getGroundObject() on any wheel I always get a null pointer back. Is that correct? I would have expected that it returns the floor (the one with the monkey texture :slight_smile: ).


//in simpleUpdate(float tpf)

ground = vehicle.getWheel(0).getGroundObject(); // always returns null


However if I call


ground = vehicle.getWheel(0).getWheelInfo().raycastInfo.groundObject;


I get something back.

So, is there any rolling friction calculated for the wheels and if so,

has the floor any influence on that rolling friction?



You can set the friction per wheel. GetGroundObject is not functional, also not in native bullet. The object returned is a dummy object.

Ok, but how can I set the friction per wheel?

There is a method setFrictionSlip(), but that has no influence on the rolling friction, has it? If I set a high friction slip (e.g. 1000f) the wheel has a lot of grip, but it doesn’t slow down as it rolls.

Ah, that is axis friction you are talking about. Simulate that by setting a brake value.

Ah okay, I thought about setting a brake value, but I was unsure if that is a correct way to do that :slight_smile:

I am currently experimenting if it is possible to create a NFS like arcade racing game. Simple engine simulation works so far (revolutions per minute, gear, differential, rear-wheel drive), but all just hacked together with some variables :slight_smile: I’ll create a new topic, if I have stuffed things in classes :wink:


I currently have the same problem with Vehicles. Of course I can set a brake value. But the brake function only influences the car speed when the accelerate funktion is called with parameter “0” before, right?

so when I call accelerate(200) and later accelerate(20) the car speed won’t slow down to the maximum speed, which would have been reached by calling accelerate(20). Is there a better solution to solve this problem instead of doing speed measurements (means evaluating (high-)speed of the vehicle at different acceleration forces and masses ect.) and braking down the vehicle manually until the “accelerate(20)” 's high speed is reached?

No, not right, its the friction of the axis, just like I said. Your preconception didn’t change anything about that :wink:

Ok. Just tried by setting the “rollinfluence”…

“Reduces the rolling torque applied from the wheels that cause the vehicle to roll over.”

sounds to me that this effects a similar behavior than calling manually





accelerate(0) Jippiee… now my brake function works again. But it doesnt. :frowning:

Why won’t you believe me? You think I want to mislead you? Rollinfluence keeps the car from tipping over sideways when going in a curve by reducing (in a hackish way) the resulting roll influence on the car. Has nothing to do with the axes whatsoever. But I guess I am superfluous here anyway, hf.

Sorry… well I am working on an scientific simulation. Propably I will be asked all those stupid questions and when I dont have answers for it this would not be very good. And there will clearly be the question why it is not possible to simulate friction (by the engine! not manually) with a vehicle and a ground when using a physics engine. So you your answers are not superfluous. Thanks by the way for the support! :wink:

Its a raycast vehicle, a ray is infinitely thin and thus cannot cause friction, simple as that. If you want to simulate a rolling cylinder (like a car wheel), rotate a cylinder with a hingejoint.

I want to simulate a body which has electromotors at arbitary positions. Each electromotor shell be able to effect a movement of the body in the x,z-plane (depending on the placement, direction ect). I figured that the VehicleControl is a simple and good solution due to the possibilities (adding wheels at arbitary positions, direction and apply forces per wheel) one has with it.

Is there a possibility to calculate the rotations per second of the wheel? My intention was to read the getDeltaRotation of VehicleWheel and implementing com.jme3.bullet.PhysicsTickListener to get informed when there is a physics step is done (because: getDeltaRotation" returns how many degrees the wheel has turned since the last physics step".) Better solutions?

Did you ever get this solved? I would like to see how you got it to work.

Here is what I am using now. The class extends VehicleControl and has setter and getter methods for a rolling friction that slows the car down. It also takes the brake force into account, which means the more you brake the less you will accelerate as I already stated here.

import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.control.VehicleControl;
import com.jme3.bullet.objects.VehicleWheel;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;
import java.util.ArrayList;

public class FrictionVehicleControl extends VehicleControl {

public FrictionVehicleControl(CollisionShape shape, float mass) {
    super(shape, mass);

public FrictionVehicleControl(CollisionShape shape) {

public FrictionVehicleControl() {

protected class WheelState {
    public WheelState() {
        brakeForce = rollingFriction;
        engineForce = 0f;
    public float brakeForce;
    public float engineForce;

protected ArrayList wheelStates = new ArrayList();
protected float rollingFriction = 10f;

public float getRollingFriction() {
    return rollingFriction;

public void setRollingFriction(float rollingFriction) {
    this.rollingFriction = rollingFriction;

public VehicleWheel addWheel(Spatial spat, Vector3f connectionPoint, Vector3f direction, Vector3f axle, float suspensionRestLength, float wheelRadius, boolean isFrontWheel) {
    wheelStates.add(new WheelState());
    return super.addWheel(spat, connectionPoint, direction, axle, suspensionRestLength, wheelRadius, isFrontWheel);

public void removeWheel(int wheel) {

public void accelerate(float force) {
    for (int i = 0; i < wheels.size(); i++) {
        accelerate(i, force);

public void accelerate(int wheel, float force) {
    WheelState ws = wheelStates.get(wheel);
    ws.engineForce = force;
    applyWheelState(wheel, ws);

public void brake(float force) {
    for (int i = 0; i < wheels.size(); i++) {
        brake(i, force);

public void brake(int wheel, float force) {
    WheelState ws = wheelStates.get(wheel);
    ws.brakeForce = force  0) {
        if (ws.engineForce > 0) {
            super.accelerate(wheel, delta);
        } else {
            super.accelerate(wheel, -delta);
        super.brake(wheel, 0f);
    } else {
        super.accelerate(wheel, 0f);
        super.brake(wheel, -delta);