Hiya all!
I’m having some issues with AWPRaycastVehicle. I’m new at away physics, and I’m trying to build some sort of basic car demo, just to learn how phys engine works.
I have created an instance of AWPRaycastVehicle, added the wheels and everything. It all look fine, but as you can see in the linked swf the wheels are drifting away when you apply engine force to the car.
It’s hard to find extensive documentation on the subject, but I found some google docs here
In the paragraph called “Suspention Constraints” I read this: “the suspension limits stops the wheels penetrating the chassis, or flying off the vehicle.” But I can’t seem to find any property called suspentionLimit on AWPWheelInfo nor in AWPVehicleTuning.
and here is some code that shows the parameters I’ve set:
var body : AWPRigidBody = new AWPRigidBody(carShape, chassi, 500);
body.activationState = AWPCollisionObject.DISABLE_DEACTIVATION;
body.linearDamping = 0.1;
body.angularDamping = 0.1;
body.friction = 0.9;
body.position = new Vector3D(0, 1500, 0);
// main.physicsWorld.addRigidBody(body);
AWPDynamicsWorld.getInstance().addRigidBody(body);
// create vehicle
var turning : AWPVehicleTuning = new AWPVehicleTuning();
turning.frictionSlip = 20;
turning.suspensionStiffness = 200;
turning.suspensionDamping = 0.85;
turning.suspensionCompression = 0.83;
turning.maxSuspensionTravelCm = 10;
turning.maxSuspensionForce = 8000;
_vehicle = new AWPRaycastVehicle(turning, body);
AWPDynamicsWorld.getInstance().addVehicle(vehicle);
// _vehicle.
// add four wheels
_vehicle.addWheel(BLW, new Vector3D(-200,0,340), new Vector3D(0, -1, 0), new Vector3D(-1, 0, 0), 50, 100, turning, true);
_vehicle.addWheel(BRW, new Vector3D(200,0,340), new Vector3D(0, -1, 0), new Vector3D(-1, 0, 0), 50, 100, turning, true);
_vehicle.addWheel(FLW, new Vector3D(-200,0,-355), new Vector3D(0, -1, 0), new Vector3D(-1, 0, 0), 50, 100, turning, false);
_vehicle.addWheel(FRW, new Vector3D(200,0,-355), new Vector3D(0, -1, 0), new Vector3D(-1, 0, 0), 50, 100, turning, false);
for (var i:int = 0; i < _vehicle.getNumWheels(); i++)
{
var wheel : AWPWheelInfo = _vehicle.getWheelInfo(i); wheel.wheelsDampingRelaxati wheel.wheelsDampingCompressi wheel.suspensi
wheel.rollInfluence = 0.01;
}
Help anyone?