jolt-driving
Jolt driving
Target: Three.js 0.187.0 (three for the maths; the kit draws nothing) and jolt-physics 1.0.0, the wasm-compat build. Three companion files sit in this folder. Copy them into the project. They import only three, and the caller passes in the Jolt namespace it initialised:
scripts/jolt-world.js:createJoltWorld(Jolt, options)andcreateHeightfieldRing(world, samplesFor, options)scripts/jolt-vehicle.js:class WheeledVehicle,VEHICLE_DEFAULTS,SURFACESscripts/jolt-towing.js:class TowHitch,TRAILER_DEFAULTS
What it is
A four-wheel vehicle driven by Jolt's own VehicleConstraint and WheeledVehicleController. Jolt solves suspension, tyre slip, weight transfer and the drivetrain. On top sits a thin handling layer, and every constant in it was settled by driving tests. It covers steering smoothing and taper, a brake pedal that reverses once the vehicle has stopped, a holding brake with hysteresis, a park pin that puts the body to sleep, friction curves per surface, a handbrake slide, extra gravity in the air, water buoyancy and drag, and a fell-through net. Around the vehicle the kit has a world with two layers, heightfield colliders only in the 3x3 chunks around the vehicle, a mesh-shape queue, body retirement on a budget, and ray casts that cannot hang. A trailer couples to it with a swing-twist joint.
When to use
- Driving games and simulations where the car should feel physical (suspension, body roll, grip loss), not arcade-on-rails.
- Large streamed terrain: colliders follow the vehicle, and the rest of the world has none.
- Use something else for a kinematic or arcade car with no real physics, for a pure flight model, or for tracked vehicles (Jolt has a
TrackedVehicleController, but this kit does not cover it).