I’m having trouble with my VehicleControl wheels digging into the floor and inhibiting the movement of my vehicle. I’m trying to collide with an obj model using RigidBodyControl.

My car class:

```
package mygame;
import com.jme3.bullet.collision.shapes.BoxCollisionShape;
import com.jme3.bullet.collision.shapes.CompoundCollisionShape;
import com.jme3.bullet.control.VehicleControl;
import com.jme3.material.Material;
import com.jme3.math.FastMath;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.scene.shape.Cylinder;
/**
*
* @author codex
*/
public class Car {
float x, y, z;
Spatial model;
Material mat;
CompoundCollisionShape compoundShape;
BoxCollisionShape box;
Node vehicleNode = new Node("car");
VehicleControl vehicle = new VehicleControl();
float accel = 1.5f;
float turn = 0f;
Vector3f grav = new Vector3f(0, -1, 0);
float friction = 0.7f;
float mass = 0.8f;
float stiffness = 60.0f;
float compValue = .3f;
float dampValue = .4f;
Vector3f wheelDirection = new Vector3f(0, -1, 0);
Vector3f wheelAxle = new Vector3f(-1, 0, 0);
float radius = 1f;
float restLength = 0.3f;
float xOff = 3f;
float yOff = -1f;
float zOff = 2f;
Car(float x, float y, float z, Spatial model, Material mat) {
this.x = x;
this.y = y;
this.z = z;
this.model = model;
this.mat = mat;
}
protected Node createVehicle() {
compoundShape = new CompoundCollisionShape();
box = new BoxCollisionShape(new Vector3f(1.2f, 0.5f, 2.4f));
compoundShape.addChildShape(box, new Vector3f(0, 1, 0));
vehicle = new VehicleControl(compoundShape, 400);
model.setMaterial(mat);
Quaternion rotate = new Quaternion();
rotate.fromAngleAxis(0.5f*FastMath.PI, new Vector3f(0, 1, 0));
model.setLocalRotation(rotate);
vehicle.setSpatial(model);
buildWheels();
//vehicle.setGravity(grav);
//vehicle.setRollInfluence(0, turn);
//vehicle.setFriction(friction);
vehicle.setMass(mass);
vehicle.setSuspensionCompression(compValue * 2.0f * FastMath.sqrt(stiffness));
vehicle.setSuspensionDamping(dampValue * 2.0f * FastMath.sqrt(stiffness));
vehicle.setSuspensionStiffness(stiffness);
vehicle.setMaxSuspensionForce(10000.0f);
//vehicle.setPhysicsLocation(new Vector3f(x, y, z));
vehicleNode.attachChild(model);
vehicleNode.addControl(vehicle);
return vehicleNode;
}
private void buildWheels() {
Node wbl = new Node("back left wheel");
Node wbr = new Node("back right wheel");
Node wfl = new Node("front left wheel");
Node wfr = new Node("front right wheel");
Cylinder wheelMesh = new Cylinder(16, 16, radius, radius * 0.6f, true);
// connectionPoint, direction, axle, suspensionRestLength, wheelRadius, isFrontWheel
// back wheel left
Geometry wheels1 = new Geometry("wheel 1", wheelMesh);
wfl.attachChild(wheels1);
wheels1.rotate(0, FastMath.HALF_PI, 0);
wheels1.setMaterial(mat);
vehicle.addWheel(wfl, new Vector3f(-xOff, yOff, zOff),
wheelDirection, wheelAxle, restLength, radius, true);
// back wheel right
Geometry wheels2 = new Geometry("wheel 2", wheelMesh);
wfr.attachChild(wheels2);
wheels2.rotate(0, FastMath.HALF_PI, 0);
wheels2.setMaterial(mat);
vehicle.addWheel(wfr, new Vector3f(xOff, yOff, zOff),
wheelDirection, wheelAxle, restLength, radius, true);
// front wheel left
Geometry wheels3 = new Geometry("wheel 3", wheelMesh);
wbl.attachChild(wheels3);
wheels3.rotate(0, FastMath.HALF_PI, 0);
wheels3.setMaterial(mat);
vehicle.addWheel(wbl, new Vector3f(-xOff, yOff, -zOff),
wheelDirection, wheelAxle, restLength, radius, false);
// front wheel right
Geometry wheels4 = new Geometry("wheel 4", wheelMesh);
wbr.attachChild(wheels4);
wheels4.rotate(0, FastMath.HALF_PI, 0);
wheels4.setMaterial(mat);
vehicle.addWheel(wbr, new Vector3f(xOff, yOff, -zOff),
wheelDirection, wheelAxle, restLength, radius, false);
vehicleNode.attachChild(wbl);
vehicleNode.attachChild(wbr);
vehicleNode.attachChild(wfl);
vehicleNode.attachChild(wfr);
}
protected void forward() {
vehicle.accelerate(accel);
}
protected void steer(String binding, boolean isPressed) {
if (binding.equals(Main.LEFT)) {
if (isPressed) { turn += .5f; } else { turn += -.5f; }
} else if (binding.equals(Main.RIGHT)) {
if (isPressed) { turn += -.5f; } else { turn += .5f; }
}
vehicle.steer(turn);
}
protected void steerLeft() {
vehicle.steer(-turn);
}
protected VehicleControl getPhysics() {
return vehicle;
}
protected Vector3f getPos() {
return vehicle.getPhysicsLocation();
}
protected Vector3f getDirection() {
return vehicle.getForwardVector(grav);
}
}
```