Friction and impact
Skill ferret-physics-friction-impact · download all skills · SKILL.md
When to use#
Slippery floors, rails, skis; bouncy or dead bodies; clay and magnets; sound or damage from hits.
The model#
The kernel already applies Coulomb friction, rolling resistance and restitution from the materials. friction and impact add what a game dials per scope, so a patch of ice can be a zone as well as a material. The value is read at the dynamic body's entity and the contact point. impact has a restitution scale, a rest threshold, loss of bounce at high speed, stick, and emits physics:impact with its energy.
Steps#
- Enable the capability; set values at zone or entity scope.
- Make things settle: raise
threshold, orscalebelow 1. - Sound and sparks: listen to
physics:impact(respectminEventSpeed). - Damage from hits belongs to
strength(ferret-physics-strength), driven by the same contacts. - Rolling and pivot friction need the material's
rollingFriction.
Check afterwards#
A block on a slope creeps or holds as μ against tan(angle) predicts; a dropped ball's bounce height follows e² h for spin-free spheres.
What usually goes wrong#
- Nothing slides on ice: capability off, or the scope key is not the dynamic body's.
- A ball never stops rolling: no
rollingFriction, androllingScalemultiplies zero. - Anisotropy, pivot friction and
stickdo nothing on Havok. scaleabove 1 gives restitution above 1: energy appears.
Files#
reference/friction.md— Friction by scope: slippery zones, per-body grip, rolling and pivot resistance, and anisotropic friction for skates, rails and skis.reference/impact.md— Collisions as a dial: restitution scale, rest threshold, bounce falloff at speed, sticking bodies, and the impact event with its energy.reference/api-physics-friction.md— every export of@ferret/physics-frictionwith signature and doc commentreference/api-physics-impact.md— every export of@ferret/physics-impactwith signature and doc comment