rules.module
README.md
traversalKit.rules
Climbable by rule, so a town or a mountain with sensible colliders just works with no tagging. traversalKit registers this test with climbKit (ledge.addClimbRule); it decides only for surfaces nobody marked (a climbable attribute or a ClimbSurface always wins).
A surface climbs when:
- it is not a moving body (characters, dynamic or kinematic physics) and not smooth (glass, ice, metal, polished, chrome, plastic, lacquer, water, by material or entity name);
- it is steep enough: at least the assist's
ruleSteepnessdegrees from horizontal; - it is tall enough: the face stands at least
ruleMinHeightabove the ground under it (shorter ones are mantled and vaulted instead); - it gives a hold: a known hold kind by its material or name (stone, brick, ashlar, wood, timber, plank, bark, rock, cliff, granite, bamboo, rope, ladder, …) or terrain (cliff); or an unknown material at least
ruleRoughnessrough and no taller thanruleMaxHeight.
Usable edges (ledges, wall tops, eaves) are always grabbable and mantled by climbKit whatever the rule says.
local Rules = require("traversalKit.rules")
print(Rules.explain(wall.id, hit).reason) -- "stone by material", "too shallow (40 deg < 68)", ...
install(assist), uninstall(), explain(entityId, hit), active(), RULE_NAME.