Skip to content

Land vehicles in water: flooding over time, wading dynamic plants, lake-bed friction - #1542

Merged
transfix merged 2 commits into
masterfrom
feat/wading-flood-world
Nov 26, 2026
Merged

transfix merged 2 commits into
masterfrom
feat/wading-flood-world

Conversation

@transfix

Copy link
Copy Markdown
Owner

Fills the three gaps left after wading (#1348): water flooding a vehicle over time, the world's vehicles in water (GB2 open item), and lake-bed friction (GB2 open item). One of the "fill every water-physics gap" sessions; the ocean roadmap's new "As built (land vehicles in water)" block has the detail.

Flooding over time

wading_desc::flood_area (m², opt-in; 0 floods at once, as before).

  • With an area, the cabin and engine bay (the box's 1 - displacement) take the water in through openings at the chassis box's bottom, at an orifice's rate: Q = C_d A sqrt(2 g dh), with C_d 0.6 and dh the water over the openings outside less the water inside.
  • The box floats sealed in the field step, and the water inside adds its weight at its centroid (its weight, not its inertia).
  • Out of the water, it drains through the same openings.
  • Each step is exact for the outside level at its start (sqrt|dh| closes at a constant rate), so the level never overshoots.
  • The water inside is state. It is saved only while there is any (bit 2 of the vehicle's mode byte), so a vehicle that never holds water saves the bytes it always has.
  • Both presets keep 0: the Humvee's engine bay is open below and its doors are soft, and the RoboRacer's shell is open below.
  • Sources: McDonald and Giesbrecht 2013, Aviat. Space Environ. Med. 84(5) (a car floats for about 15 s to a minute); the STAB&S 2021 flooding-progression benchmark (level water inside each compartment, Bernoulli flow through each opening, C_d about 0.6).

PhysicsVehicle.AHardDooredHumveeFloodsOverSecondsAndDrainsOnTheWayOut: a Humvee with 0.1 m² of openings, put into 0.7 m of water.

inside tires carry
0.5 s 0.025 m³ 12.4 kN (riding 21 mm high)
10 s 0.506 m³ (orifice model 0.492) 17.7 kN
60 s, level inside and out 0.787 m³ 19.6 kN = the flooded-at-once model's
driven out onto dry land 0.487 m³ 31.0 kN (26.2 dry + 4.8 of water)
16 s later 0 exactly 26.2 kN

A save taken while it drains restores and replays to the same hash. The ledger's residual is 223 J of 372 kJ.

The world's vehicles

GB2 asked whether the dynamic/dynamic4w chassis boxes get sealed-box buoyancy. I checked:

  • jolt fleets and Ariadne's Jolt vehicles use presets with wading on, so they waded already.
  • The dynamic plants' boxes do take the fluids' sealed-box push in the world step. But every substep the plant puts each box back at its model's pose, and only a collision takes anything back, and then only the plane's pose and twist. So nothing floated them. Instead, they drove through water of any depth as on dry ground.

dyn_bike_plant and dyn_4w_plant now wade (dyn_wading.h), from world::water_at at each tire:

  • the water's drag goes into the model's own drag term (still water only);
  • the load the tires and the flooded box displace lowers each tire's grip;
  • the tires soak to the wet friction of the material under them, and aquaplane;
  • past fording_depth the engine floods: no drive, the brakes still work. The flag is kept in dyn_4w_saved / dyn_bike_saved.

A vehicle that waded in a tick is not exact in entity_plant, because the twin replays no water.

Dyn4wPlant.DrivesIntoALakeAndWades and DynBikePlant.DrivesIntoALakeAndWades drive a Humvee into 0.5 m of water, then 1.2 m:

  • Wading off: it runs tick for tick like a dry run (18.4 m/s at x = 85).
  • Wading on: 4.64 m/s there. That is where its drive meets 289 kg/m of drag (the model gives 4.67).
  • 3738 N is lifted off its tires (the Jolt Humvee in physics: land vehicles wade in water (opt-in vehicle_desc::wading) #1348: 3733 N), and each tire's grip is × 0.41.
  • Its engine floods with its front axle at 90.3 m, and it stops by 99.7 m.

Lake beds

water_deep ground keeps mu 0.10 under a data node's water_level: water. That value stands for the water itself where no fluid covers the class. Under a fluid the tire stands on the bed, and wading handles the water's own effects.

  • The water classes' mu_wet is now their bed's, soaked: water_shallow 0.45 (sand and gravel) and water_deep 0.20 (mud). Håkanson and Jansson, Principles of Lake Sedimentology, 1983. Dry mu is unchanged.
  • Under standing water, a wading tire runs to wet_friction whether it is below or above friction.
  • physics::wet_friction (the rain's) never raises a class above its dry mu.
  • No change to scene_world.cpp, world_nodes.cpp, set_water or the nav rasters. I told the terrain generator session on the bus.

PhysicsVehicle.OnALakeBedItBrakesWithTheBedsWetFriction: braking from 4 m/s on water_deep under 0.5 m of water, the tires use mu 0.196 and the vehicle decelerates at 2.66 m/s², the same as on a 0.20 ground under the same water. With no water over the class, the tires use 0.100 and it decelerates at 1.43 m/s².

Hashes

No pinned hash changed. With wading off, or on with no flood_area and no water-class ground, every vehicle saves and steps as before.

Testing

Each new test fails with its change switched off.

  • The flooding and lake-bed tests were run with flood_area 0 and with master's grip rule and table: the flooding test then finds no water inside at any time (tires at 19.6 kN from the start), and the lake-bed test finds mu 0.099 and 1.45 m/s².
  • The plant tests' own wading-off run reproduces master's behaviour.

Local results (Windows, MSVC Release, cvcGL off): physics_vehicle_test 37/37, physics_dyn_4w_plant_test 9/9, physics_dyn_bike_plant_test 12/12, physics_world_test 47/47, every other physics_* suite, the ocean_* suites, world_surface/geometry/generated, nav_world_grid/planes, nav_plant_test 23/23 and ariadne_scene_world_test 145/145 (both without the Convergence/Stress/Benchmark suites, as CI's main run). physics_replay_test: all 1240 steps match the trace. clang-cl syntax-checks every changed source. git-clang-format is clean on the changed lines

Not run: cvcGL suites, Linux, macOS, wasm (CI).

Not done

  • Wading knobs in pycvc and world_binding: the bindings session has them.
  • The dynamic plants know no current, and they flood at once.
  • Vehicles read water without the wake.
  • A One World client's dynamic model has no water to wade in (O16).

…ke-bed friction

Fills the three gaps left after wading (#1348).

Flooding over time (vehicle.h, wading_desc::flood_area, opt-in). With an area,
the cabin and engine bay take the water in through openings at the chassis
box's bottom at an orifice's rate, Q = C_d A sqrt(2 g dh), C_d 0.6. The box
floats sealed in the field step and the water inside adds its weight at its
centroid; out of the water it drains through the same openings. Each step is
exact for the outside level at its start, so the level never overshoots. The
water inside is state, saved only while there is any (bit 2 of the mode
byte), so a vehicle that never holds water saves the bytes it always has.
0 (the default, and both presets) floods at once, as before.

The world's vehicles (GB2 open item). Jolt fleets and Ariadne's Jolt vehicles
use presets with wading on, so they waded already. The dynamic plants'
chassis boxes do take the fluids' sealed-box push in the world, but each
substep puts them back at the model's pose, so nothing floated them: they
drove through water as on dry ground. dyn_bike_plant and dyn_4w_plant now
wade from world::water_at at their tires (dyn_wading.h): drag in the model's
drag term, grip lowered by the lifted load and soaked to the material's wet
friction, aquaplaning, and the engine flooding past fording_depth (kept in
their saves). A vehicle that waded in a tick is not `exact` in entity_plant.

Lake beds (GB2 open item). water_deep's mu 0.10 stands for the water where no
fluid covers the class; under a fluid the tire is on the bed. The water
classes' mu_wet is now their bed's, soaked: water_shallow 0.45 (sand and
gravel), water_deep 0.20 (mud). A wading tire runs to wet_friction whether it
is below or above friction; physics::wet_friction (rain) never raises a class
above its dry mu. scene_world.cpp, set_water and the nav rasters are
unchanged.

No pinned hash changes: with wading off, or on with no flood_area and no
water-class ground, every vehicle saves and steps as before.

Tests: PhysicsVehicle.AHardDooredHumveeFloodsOverSecondsAndDrainsOnTheWayOut,
PhysicsVehicle.OnALakeBedItBrakesWithTheBedsWetFriction,
Dyn4wPlant.DrivesIntoALakeAndWades, DynBikePlant.DrivesIntoALakeAndWades.
Conflict in docs/roadmap/OCEAN-AND-WEATHER-ROADMAP.md: master's boat-model paragraph (#1538's hull lift) with this branch's last sentence pointing land vehicles at the new wading section.
@transfix
transfix enabled auto-merge (squash) November 26, 2026 07:01
@transfix
transfix merged commit e48ea00 into master Nov 26, 2026
30 checks passed
@transfix
transfix deleted the feat/wading-flood-world branch November 26, 2026 08:26
transfix added a commit that referenced this pull request Nov 26, 2026
…lant.wading) (#1558)

#1542 merged before #1548, so the bindings take its fields:

- wading_desc.flood_area (and as_dict); vehicle_state water_inside and
  water_inside_mass; dyn_bike_plant.wading(i) / waded(i); WorldEntities'
  wading dict;
- world_binding: a tuning.wading.flood_area knob (whether it is 0 stays
  fixed: set_vehicle refuses the change, so it is ignored) and the
  water_inside / water_inside_mass telemetry, with key metadata.

test_pycvc_physics_water: a hard-doored Humvee (flood_area 0.1) in 0.7 m
fills over seconds to the level outside (0.787 m^3 at 60 s), published by
the binding; a dyn_bike_plant Humvee in 0.5 m wades (3738 N lifted).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant