Builtin Library
README.md
ecs.FluidForces
Spec for ecs.FluidForces, which maps to the native FluidForces: how the air and water act on the surface of the body the entity holds, inside every physics step. The FluidForces component drives it; this is the typed value the generic ecs verbs build and read.
Fields
drag: number?: the pressure drag coefficient of a face meeting the flow head-on.skinDrag: number?: the skin friction coefficient of the flow along a face.buoyancy: number?: the factor on the water's pressure by depth; 1 floats the body as the water it displaces weighs, 0 takes none.waveDamping: number?: the factor on the damping of the waves the body makes moving at the water's surface, which settles its bobbing.magnus: number?: the lift a spinning body takes per unit of spin ratio.air: boolean?: whether the air acts on it.water: boolean?: whether water acts on it.density: number?: the body's density relative to the water; above 0 the water acts on the body as on a body of that density, so that share of its hull floats under still water whatever its mass. 0 lets its mass and volume decide.hullSize: { x, y, z }?: a box, full extents in the body's own frame, standing for a rigid body's surface in place of its solid colliders; zero on any axis takes the colliders.hullCenter: { x, y, z }?: the centre of that box, in the body's own frame.waterBody: string?: the one body of water it reads, by the namePhysics.defineWatergave it; empty reads whichever covers each point.enabled: boolean?: whether the forces act.
Usage
ecs.insertSync(id, ecs.FluidForces{ drag = 1.0, buoyancy = 1.0 })
ecs.set(id, ecs.FluidForces{ magnus = 0.8 })