Give the vehicles real wheels #111
Labels
No labels
animation
audio
blocked
bug report
controversial
documentation
easy
feature request
hard
medium
multiplayer
physics
ui
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
elsie/liuverse#111
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The vehicles are a kinematic model, and they show it.
vehicle::step_vehicleintegrates a speed, turns a heading, and moves thevehicle along a line. The drift model on top of it —
velocity_dirversusyaw, the slip angle,DRIFT_MAX_SLIP— is a hand-rolled approximation ofwhat a tyre does. The result is a scooter that slides sideways across a
campus without ever leaning, a bus that corners like a shopping trolley, and
a bicycle that cannot fall over. Nothing on the campus can hit anything, and
nothing can be hit.
Rapier ships a ray-cast vehicle controller
(
rapier3d::control::DynamicRayCastVehicleController, ported from Bullet'sbtRaycastVehicle): a chassis rigid body, wheels that ray-cast down to findthe ground, a suspension that compresses over bumps, and tyre forces that
decide what the vehicle does with the grip it has.
What that changes
vehicle does are the same number, because the vehicle actually rolls. A
scooter leans into a corner because the chassis is tipping.
does a scooter that hits a kerb sideways. Neither can happen today.
DRIFT_MAX_SLIP,DRIFT_SLIDE_RATE,GRIP_REALIGN_RATEanddrift_turn_rateexist to fake what a tyre doeswith lateral force. A real wheel does it, and the hand-rolled constants go
away with the code that reads them.
Mobility::GROUND_FLOORsupportheight under the vehicle becomes the ray the wheel casts. A scooter on the
hill finds the hill; a scooter half on a kerb rides up it.
is a separate issue (the ragdoll), but it needs this one first.
Where it fits
The vehicles are server-authoritative today — the server steps them and
sends
VehiclePoseat 20 Hz — and that stays. The physics world lives on theserver; the client keeps its local vehicle as the stand-in it already has
(
Vehicle::from_pose).That means
VehiclePosegrows fields, and the wire contract is append-only:new fields go at the end of the struct, and
ClientMsg/ServerMsgvariantsare appended, never reordered. The fields worth carrying are the ones a client
cannot derive from
posandyaw: the roll and pitch of the chassis, thesuspension compression per wheel, and whether the wheels are on the ground at
all. Those last two are what a client needs to draw a wheel that is off the
ground.
The cost
Rapier's vehicle controller is a Bullet port and it is a chassis: one rigid
body with ray-cast wheels, not four wheels with their own rigid bodies. That
is the right shape for a scooter, but a bus wants a body that leans and a
suspension that does not bottom out, which is more than a ray-cast wheel
gives. Expect to hand-tune the
WheelTuningperVehicleKind— theVehicleKindenum already ownseye_height,max_speed,acceleration,braking,turn_rate,steer_maxanddrift_turn_rate, and it would growthe suspension and grip constants next to those.
DynamicRayCastVehicleControllerlives inrapier3d::control, which isnot in the crate's prelude. It is an explicit import.
Related
drawn, so the seat positions ride along unchanged.
The wheels are drawn now. The physics is not.
Vehicles have real rolling wheels: tires and rims as their own meshes on per-kind axles, with the roll phase advanced by the post-collision travel so they match the ground. The ground under a vehicle is a real surface too, with a per-kind speed and grip answer for ice, soft ground and pavement.
What is left is the part this issue is actually about: the lean is still drawn rather than simulated, the drift model is still the hand-rolled speed-and-heading one, nothing can tip over, and nothing on the campus can be hit. So the issue stays a physics issue; what has landed is the presentation a real wheel would have to replace.
The physics half of this is not in scope right now, and what is here is close enough to close the issue out.
What landed is the presentation a real wheel would need to replace: tires and rims as their own meshes on per-kind axles, the roll phase advanced by post-collision travel so they match the ground, and a real surface under the vehicle with a per-kind speed and grip answer for ice, soft ground and pavement.
What is left is the simulation the issue is actually about — a chassis that leans instead of a drawn lean, a tyre model instead of the hand-rolled speed-and-heading drift, rollover, and vehicles meeting players. That rides on the physics engine in #110, which is out of scope for now.
Closing as close-enough. Reopen if the simulated half comes back on the table.