This class will be moved out of the core library in future versions.
Example
// Create a dynamic body for the chassis varchassisBody = newBody({ mass:1 }); varboxShape = newBox({ width:0.5, height:1 }); chassisBody.addShape(boxShape); world.addBody(chassisBody);
// Create the vehicle varvehicle = newTopDownVehicle(chassisBody);
// Add one front wheel and one back wheel - we don't actually need four :) varfrontWheel = vehicle.addWheel({ localPosition: [0, 0.5] // front }); frontWheel.setSideFriction(4);
// Back wheel varbackWheel = vehicle.addWheel({ localPosition: [0, -0.5] // back }); backWheel.setSideFriction(3); // Less side friction on back wheel makes it easier to drift vehicle.addToWorld(world);
// Steer value zero means straight forward. Positive is left and negative right. frontWheel.steerValue = Math.PI / 16;
// Engine force forward backWheel.engineForce = 10; backWheel.setBrakeForce(0);
TopDownVehicle
Deprecated
This class will be moved out of the core library in future versions.
Example