FERRETGame engine over Babylon.js
Ferret

@ferret/physics-friction

friction dialled by scope, rolling and pivot friction.

friction by scope. The kernel already applies Coulomb static and kinetic friction, rolling resistance and (optionally) pivot friction from the materials of the two surfaces; this adds what a game dials per scope, so a patch of ice can be a zone as well as a material:

  scale         multiplies static and kinetic friction                           (1)
  rollingScale  multiplies the rolling resistance                                (1)
  pivot         pivot (spinning) friction coefficient, overriding the material   (the material's)
  anisotropy    { axis: [x,y,z], across }: across the axis the coefficient is `across` times the one along it
                (an ice skate: across ≈ 20; a rail or a ski)

2 exports · source in packages/physics-friction/src

Functions

friction function

function friction(): Capability

On a kernel without contact hooks (Havok) the same dials reach the solver another way: each body's surface is its material's friction times the scale where the body is, and rolling resistance (which Havok lacks) is a torque μr·N·r against the roll, with N the normal force the body's contacts carried in the last step. Anisotropy and pivot friction need the hooks.

packages/physics-friction/src/index.ts:21

Constants

FRICTION_DEFAULTS const

const FRICTION_DEFAULTS: { scale: number; rollingScale: number; pivot: number | undefined; anisotropy: { axis: Vec3; across: number; } | undefined; }

friction by scope. The kernel already applies Coulomb static and kinetic friction, rolling resistance and (optionally) pivot friction from the materials of the two surfaces; this adds what a game dials per scope, so a patch of ice can be a zone as well as a material:

  scale         multiplies static and kinetic friction                           (1)
  rollingScale  multiplies the rolling resistance                                (1)
  pivot         pivot (spinning) friction coefficient, overriding the material   (the material's)
  anisotropy    { axis: [x,y,z], across }: across the axis the coefficient is `across` times the one along it
                (an ice skate: across ≈ 20; a rail or a ski)

packages/physics-friction/src/index.ts:14