74. Wheels on the ground
Status: unimplemented — design draft. Today `metaverse-engine/physics/vehicle.coax` drives Orbit League's cars: one rigid body from `metaverse-engine/physics/sim/rigid.coax`, four suspension rays, tyres inside the friction circle, sticky wheels, jumps and dodges, against a list of planes. It is a game-layer module that only Orbit League loads. This chapter plans a vehicle controller on The OpenAgents Metaverse Engine's rigid bodies and queries. Nothing in
metaverse-engine/runs yet.
A wheeled vehicle is a rigid body with a few rays and a tyre model. It doesn't need a full articulated wheel model to feel right in a game. It does need the same ground queries as the character, the same fixed step, and the same replay, so a car race replays exactly.
What this chapter teaches
- How raycast suspension turns a ground query into a spring and damper force.
- How a friction circle limits drive, brake and side grip together.
- How sticky wheels and air control work, and where they leave real physics.
- When to use this model and when to use Part IV's articulated bodies.
Outline
- The spec as data.
VehicleSpecholds the chassis half extents, four wheel mounts in the body frame (0 and 1 front, 2 and 3 rear), wheel radius, rest travel, stiffness (N/m), damping (N s/m), tyre frictionmu, grip, drive and brake force, top speed, steering lock withsteer_fadeat speed,stick,stick_speed(8 m/s), jump speed and air turn rate. The reference car is a 4.2 m by 1.9 m, 1,000 kg roadster (vehicle_roadster). - Suspension rays. Each step, each wheel casts down the chassis's own −Y. A wheel that reaches a surface pushes along that surface's normal with a spring and damper. In the Metaverse Engine the cast is chapter 7's raycast, not a private list of planes.
- Tyres. Drive or brake acts along the wheel and grip acts against side slip, and together they never exceed
mutimes the wheel's load. The front wheels steer, less at speed. The handbrake removes most of the rear's side grip, so the tail swings out. - Driving on any surface. The rays follow the chassis, so a wheel can meet a wall or a ceiling. While wheels touch,
stickpulls the car to the surface: always on a floor, and on a wall or ceiling only abovestick_speed. This rule is declared game physics, not engineering physics. - In the air.
airturns the chassis (pitch from throttle, yaw from steer, roll with the handbrake). A second jump within 1.25 s (DOUBLE_JUMP_WINDOW) with the stick past 0.5 (DODGE_FLICK) is a dodge: 5.5 m/s along the flick and a flip at 9.7 rad/s, with air control off for 0.6 s. - Inputs and gravity.
VehicleInput {throttle, steer, handbrake, jump}comes from chapter 4's typed actions. Gravity is an acceleration from the gravity field (gravity_at), so the same car drives in a spinning drum. - Where it stops. This controller is for games. A robot's wheels, a suspension study or a vehicle that must match measured data uses chapter 19's joints and chapter 22's contact instead.
What exists today
- metaverse-engine/physics/vehicle.coax: the controller, with
#testchecks that a roadster settles level, reaches top speed, steers, brakes, jumps, dodges, drifts, sticks to a wall when fast and falls off when slow, and that the same inputs give the same path bit for bit. - metaverse-engine/physics/sim/contact.coax and metaverse-engine/physics/sim/rigid.coax: the chassis box against planes, and the rigid body.
- docs/metaverse/space.md: the space primitives table that lists the vehicle beside gravity, thrust and orbits.
What it builds
metaverse-engine/vehicle/wheel.coax: suspension rays, tyres and the friction circle over the Metaverse Engine's queries and rigid bodies.metaverse-engine/vehicle/control.coax: steering, handbrake, stick, air control, jumps and dodges as declared game rules.
Acceptance checks and oracles
The chapter is done when:
- Every
#testin today'smetaverse-engine/physics/vehicle.coaxpasses against the Metaverse Engine modules. - A car on a heightfield ground and on a box arena takes its wheel contacts from the shared query module, with the same answers the character gets.
- A recorded Orbit League match replays to the same digests (chapter 5).
- A wheel's horizontal force never exceeds
mutimes its load, checked over a recorded drive. - Game rules such as
stickand the dodge are listed in the realm's rule module and are absent from any engineering profile.
Dependencies
Chapters 1 (the fixed step), 4 (actions), 5 (replay), 7 (queries) and 18 (rigid bodies). Chapters 19 and 22 for articulated alternatives. Chapter 63 for Orbit League. From Coax: R12 quantities for forces and speeds, and R20 rule modules for the game-only rules.