vehicleController.package
README.md
vehicleController
In a world that installs the Controllers library (
world.installLibrary({ world = "034d26cf-dc3d-4123-abad-3944f97c6a60", as = "controllers" })), every package name on this page is written with@controllers::in front of it, andasset.list("component")lists each one under that name.
VehicleController drives a car built from WheelColliders: throttle,
steering, brakes, a handbrake, boost and recovery, with arcade assists (steering
help, traction control, air control) that tune from forgiving to simulation. It
reads its intent from the player through the vehicle input map (keyboard,
gamepad and touch), or from a script (controlSource = "script",
setIntent { throttle, steer }) for traffic and AI drivers. It carries the
bodyMover tag.
| Asset | What it is |
|---|---|
VehicleController | The driver component, on the chassis entity. |
vehicleIntent | require("vehicleController.vehicleIntent").vehicle(opts): the driving intent read from an input map, for a hand-written driver. |
inputMaps.vehicle | throttle (W/S), steer (A/D), brake (Space), handbrake (Ctrl), boost (Shift), recover (R), interact, zoom (wheel), with gamepad and touch bindings. |
car.component.add("vehicleController.VehicleController", { camera = cam.id })
car.component.get("vehicleController.VehicleController"):takeControl()
With the cameraRigs package beside it (the Controllers world installs both),
the zoom control moves a chase camera named in camera.
documentation/driving builds a whole drivable car.