code wiki / (root) / nx_softjiggle.nx

nx_softjiggle.nx

buildroot/runtime/nx_softjiggle.nx

6927 B164 linesdepth 2pulls 2 transitivereach 4 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_softjiggle.nx -- JIGGLE-BONE soft dynamics (operator 2026-07-03: "we also want jiggle physics" -- the VaM-class secondary-motion substrate). Industry-standard model: a jiggle NODE is a point mass tethered to an ANCHOR (the skeleton/animation drives the anchor; the node lags, overshoots, decays = jiggle) by a spring-damper, with gravity influence and a HARD max-stretch clamp (no explosion, by construction). ALL INTEGER (pos fx256, vel fx65536, 60Hz -- the same fixed-point law as nx_phys3d) => deterministic, byte-identical replays. Per-node stiffness/damping/stretch/gravity are DATA (the moddable-architecture law: a body-part profile = 4 numbers a mod can ship). Chains (node anchored to another node) compose ponytails/ cloth strips. Base-relative: runs native AND in-wasm. license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_softjiggle.nx nx_softjiggle_gate.nx nx_wasm_physlab.nx

imports: nx_syscalls.nx

imported by: nx_softjiggle_gate.nxnx_wasm_physlab.nx

structs

none

consts

16const SJ_MAXN: i64 = 128
17const SJ_MAXC: i64 = 32

functions

19func sj_hdr(base: i64) -> *i64 { return base as *i64 } // [0]=node count [1]=capsule count
20func sj_node(base: i64, id: i64) -> *i64 { return (base + 64 + id * 128) as *i64 }
23func sj_capsule(base: i64, id: i64) -> *i64 { return (base + 64 + SJ_MAXN * 128 + id * 64) as *i64 }
24func sj_bytes() -> i64 { return 64 + SJ_MAXN * 128 + SJ_MAXC * 64 }
called by 1: main
26func sj_init(base: i64) -> i64
called by 2: mainworld_init calls 1: sj_hdr
33func sj_add_capsule(base: i64, x0: i64, y0: i64, z0: i64, x1: i64, y1: i64, z1: i64, r: i64) -> i64
called by 2: mainworld_init calls 2: sj_hdrsj_capsule
44func sj_isqrt(v: i64) -> i64
called by 2: sj_stepmain
52func sj_add(base: i64, x: i64, y: i64, z: i64, k: i64, damp: i64, maxstretch: i64, gscale: i64) -> i64
called by 2: mainworld_init calls 2: sj_hdrsj_node
66func sj_anchor(base: i64, id: i64, x: i64, y: i64, z: i64) -> i64
called by 2: maintick_at calls 1: sj_node
71func sj_chain(base: i64, id: i64, parent: i64) -> i64
called by 2: mainworld_init calls 1: sj_node
76func sj_pos(base: i64, id: i64, axis: i64) -> i64
called by 1: main calls 1: sj_node
81func sj_iabs(v: i64) -> i64 { if v < 0 { return 0 - v } return v }
84func sj_axis(x: i64, ax: i64, v: i64, k: i64, damp: i64) -> i64
called by 1: sj_step
90func sj_step(base: i64) -> i64