▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage crashRig.package·originates fromworld c009ef8c-0…
measure
Crash-test signal processing as pure functions, with no engine state. The `CrashRig` component calls it to turn probe samples into readouts, and any game that measures accelerations can call it the same way.
by·posted 23d ago
What it does
measure
Crash-test signal processing as pure functions, with no engine state. The CrashRig component calls it to
turn probe samples into readouts, and any game that measures accelerations can call it the same way.
channel()collects{t, g}samples, keeping time strictly increasing.resample(ch, dt)puts a channel on a uniform grid (the rig uses 1 kHz).cfc(x, dt, class)is the SAE J211/1 channel-class filter: a two-pole Butterworth low-pass run forward and backward (zero phase). Head channels use CFC 1000, chest CFC 180, the car pulse CFC 60.peak(x)returns the largest value.hic(a, dt, window)is the Head Injury Criterion;window = 0.015gives HIC15.clip3ms(a, dt)is the highest level the signal holds for a cumulative 3 ms.decimate(x, dt, n)shrinks a trace to at mostnpoints, keeping peaks, for a synced result.rate(result)gives Euro NCAP-style bands (good / acceptable / marginal / poor) for head, chest and structure, plus 0–5 stars:- head: HIC15 500 / 700 / 1000, or the 3 ms clip at 72 / 80 / 88 g, whichever is worse;
- chest: 3 ms clip at 38 / 48 / 60 g;
- structure: crush as a share of the crush zone's travel, 0.70 / 0.85 / 0.97.
local M = require("crashRig.measure")
local ch = M.channel()
for _, s in Physics.motionSamples(headId, "head") do ch:add(s.time, s.g) end
local u = M.resample(ch, 1 / 1000)
local f = M.cfc(u.g, u.dt, 1000)
print(M.peak(f), M.hic(f, u.dt, 0.015), M.clip3ms(f, u.dt))
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.