Add a physics engine (rapier3d) #110
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.
Blocks
#112 Throw and roll real objects
elsie/liuverse
#113 Make the playground toys real mechanisms
elsie/liuverse
#114 Let players fall over
elsie/liuverse
#115 Swing the doors open
elsie/liuverse
#116 Float on the campus water
elsie/liuverse
Reference
elsie/liuverse#110
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 campus has no physics. Everything that moves is moved by hand: the player
walks with a per-building 2-D wall-distance predicate
(
collision::can_walk_to), the vehicles are a bespoke speed-and-heading model(
vehicle::step_vehicle), and the things on the ground — benches, bins,bollards, seesaws — are drawn but never collided. Every roll, swing,
tumble, tip, fall over and bounce is a special case somebody has to
write by hand, and none of them compose.
Rapier is the obvious candidate: a pure-Rust physics engine with no renderer, a
first-class WASM story, and the joint, character-controller and ray-cast
vehicle APIs that the missing features all need. This issue is the spine; the
features it unlocks are the issues that link back to it.
What it would buy
hand-rolled speed-and-heading model. #111
#112
#113
The costs, honestly
a swept capsule" and is a per-building 2-D wall-distance predicate, because
that keeps a walker on the right floor and never snaps a jump onto the slab
above. Rapier's character controller works the other way: one shape, cast
against the world. Getting the campus's storeys right means handing Rapier
the same floor-aware geometry the predicate has today — as one collider per
slab, or as collision groups — which is a bake change, not only a code
change.
glam, withVec2/Vec3and the
Enu/WorldPosnewtypes. Rapier speaksnalgebra. The conversionlives at the edge of the physics module, but it exists, and every crossing
pays for it.
and vehicles are server-authoritative today. A physics world both must agree
on is something else: either the server owns every body and the 20 Hz pose
carries the state, or each client simulates its own and the two drift.
Across machines it wants the
enhanced-determinismfeature, which cannot becombined with
simd8.wasm32-unknown-unknownand itsown CI tests that target, but rayon falls back to one thread there, so the
web build pays single-threaded cost.
Where it would live
Rapier is pure Rust and has no rendering dependency, so it belongs in
liuverse-worldbesidecollision,vehicleandplayer— the crate whosewhole job is "the simulation, without the renderer", and whose tests are pure
in-memory. It goes into
[workspace.dependencies]like everything else.The static world is the hard part. Rapier wants colliders, and the campus is
baked as triangle soups with footprints and rings. Two ways in:
campus as one trimesh is a lot of triangles for a BVH to chew on, and it
collides the interiors with the exteriors.
interior wall ribbon, a height field for the terrain, a trimesh for the
roofs. The bake already knows how to produce all four. It is also what
makes the storeys work: a slab is a collider, so climbing a stair is a
slope and jumping under the next floor still cannot snap onto it.
The second is the one that keeps the current behaviour, so it is the one to try
first. It grows the bake a collision layer, which is a format change and
therefore a rebake.
The smaller step, if this is too much
parry3dis the same author's collision library without the dynamics solver.It gives ray casts, shape casts and overlap queries — enough for picking and
for a proper camera — at a fraction of the weight and with no authority
questions. It is the right first move if the goal is picking and not
simulation.
Related
parry3dis the same author asrapier3d, one layer down.