This time I have a little problem with the vehicle class. I think I know the solution but I couldn't find a way to implement it. What I have for example is the following:
- all wheels have radius 1
- the body has width and length of 1 unit and a height of 0.5
I create the vehilce using the following code. With the values from above this works quiet well (see image).
Code: Select all
var bodies = new List<CompoundShapeEntry>
{
new CompoundShapeEntry(new BoxShape(2, 0.5f, 10), new Vector3(0, 0, 0)),
};
var body = new CompoundBody(bodies, 61);
body.Position = new Vector3(0, 5, 0);
_vehicle = new Vehicle(body);
float wheelOffsetX = 1.5f;
float wheelOffsetY = 0;
float wheelOffsetZ = 5;
float wheelRadius = 1;
_vehicle.AddWheel(new Wheel(
new RaycastWheelShape(wheelRadius, Matrix.Identity),
new WheelSuspension(2000, 100f, Vector3.Down, .5f, new Vector3(-wheelOffsetX, wheelOffsetY, wheelOffsetZ)),
new WheelDrivingMotor(2.5f, 30000, 10000),
new WheelBrake(1.5f, 2, .02f),
new WheelSlidingFriction(4, 5)));
_vehicle.AddWheel(new Wheel(
new RaycastWheelShape(wheelRadius, Matrix.Identity),
new WheelSuspension(2000, 100f, Vector3.Down, .5f, new Vector3(-wheelOffsetX, wheelOffsetY, -wheelOffsetZ)),
new WheelDrivingMotor(2.5f, 30000, 10000),
new WheelBrake(1.5f, 2, .02f),
new WheelSlidingFriction(4, 5)));
_vehicle.AddWheel(new Wheel(
new RaycastWheelShape(wheelRadius, Matrix.Identity),
new WheelSuspension(2000, 100f, Vector3.Down, .5f, new Vector3(wheelOffsetX, wheelOffsetY, wheelOffsetZ)),
new WheelDrivingMotor(2.5f, 30000, 10000),
new WheelBrake(1.5f, 2, .02f),
new WheelSlidingFriction(4, 5)));
_vehicle.AddWheel(new Wheel(
new RaycastWheelShape(wheelRadius, Matrix.Identity),
new WheelSuspension(2000, 100f, Vector3.Down, .5f, new Vector3(wheelOffsetX, wheelOffsetY, -wheelOffsetZ)),
new WheelDrivingMotor(2.5f, 30000, 10000),
new WheelBrake(1.5f, 2, .02f),
new WheelSlidingFriction(4, 5)));
Please have a look at the attached image, this should make clear what I'm looking for...
Hope you know what I mean and thanks for your great support