Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage pursuitKit.package·originates fromworld 0a0b119f-a…

perception

What an observer can see and how fast it notices. Pure maths, no engine.

byzero-proxy @ DESKTOP-DB3UJOJ·posted 11d ago
What it does

perception

What an observer can see and how fast it notices. Pure maths, no engine.

An observer stands at (x, y, z) facing (fx, fz) on the ground plane and is of a kind the config describes
(range by light, half-angle, a near range that works whatever way it faces, and optionally how far up and
down it looks). The host supplies the one thing geometry cannot: whether the line between the two is blocked
(`hasLine`, from a physics ray or anything else).

  local Perception = require("~.modules.perception")
  local seen, distance = Perception.inView(kindCfg, light, ox, oz, fx, fz, tx, tz)        -- flat ground
  local seen, distance = Perception.inView3(kindCfg, light, { x, y, z, fx, fz }, { x, y, z })
  -- with heights: distance is the straight line; kindCfg.vertical = { up, down } (degrees) limits how steeply
  -- it looks (someone on a roof is not seen by a guard with up = 35 standing at the wall's foot)
  local rate = Perception.fillRate(cfg, "guard", {
      distance = distance, inView = seen, hasLine = true, light = 1,
      act = "wanted", concealment = { "crowd" }, described = 0.5, strikes = 0, known = false,
  })                                   -- awareness per second (0 when it cannot see or there is nothing to see)
  -- described: false / true, or 0..1 = how much of a held description the suspect matches
  -- known: this observer knows the suspect's face (cfg.known.fillFactor applies, and it notices even an idle one)
  local yaw = Perception.sweep(baseYaw, arcDegrees, period, t)   -- a camera panning to and fro

Light is 0 (dark) .. 1 (full day). Angles are degrees. Distances are metres.

The interface is documented in the header of init.luau; this file repeats it for the asset browser.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

pursuitKit.modules.perception — what an observer can see and how fast it notices. Pure maths, no engine. An observer stands at (x, y, z) facing (fx, fz) on the ground plane and is of a kind the config describes (range by light, half-angle, a near range that works whatever way it faces, and optionally how far up and down it looks). The host supplies the one thing geometry cannot: whether the line between the two is blocked (`hasLine`, from a physics ray or anything else). local Perception = require("~.modules.perception") local seen, distance = Perception.inView(kindCfg, light, ox, oz, fx, fz, tx, tz) -- flat ground local seen, distance = Perception.inView3(kindCfg, light, { x, y, z, fx, fz }, { x, y, z }) -- with heights: distance is the straight line; kindCfg.vertical = { up, down } (degrees) limits how steeply -- it looks (someone on a roof is not seen by a guard with up = 35 standing at the wall's foot) local rate = Perception.fillRate(cfg, "guard", { distance = distance, inView = seen, hasLine = true, light = 1, act = "wanted", concealment = { "crowd" }, described = 0.5, strikes = 0, known = false, }) -- awareness per second (0 when it cannot see or there is nothing to see) -- described: false / true, or 0..1 = how much of a held description the suspect matches -- known: this observer knows the suspect's face (cfg.known.fillFactor applies, and it notices even an idle one) local yaw = Perception.sweep(baseYaw, arcDegrees, period, t) -- a camera panning to and fro Light is 0 (dark) .. 1 (full day). Angles are degrees. Distances are metres.

range(kindCfg: any, light: number) → number

How far an observer of this kind sees at this light.

argtypedescription
kindCfgany
lightnumber

inView3(kindCfg: any, light: number, o: any, t: any) → void

Whether a target is inside an observer's view (cone, range and vertical limits, or the near range), and how far away it is in a straight line. Does not know about walls: combine with the host's line test.

argtypedescription
kindCfgany
lightnumber
oany
tany

inView(kindCfg: any, light: number, ox: number, oz: number, fx: number, fz: number, tx: number, tz: number) → void

The same on flat ground.

argtypedescription
kindCfgany
lightnumber
oxnumber
oznumber
fxnumber
fznumber
txnumber
tznumber

fillRate(cfg: any, kind: string, sample: any) → number

Awareness gained per second by one observer for one sample of the suspect. See the header for `sample`.

argtypedescription
cfgany
kindstring
sampleany

sweep(baseYaw: number, arc: number, period: number, t: number) → void

The facing of something that pans: `arc` degrees in all, there and back in `period` seconds, about `baseYaw` (degrees, 0 = +z, 90 = +x). Returns yaw in degrees and the unit facing (fx, fz).

argtypedescription
baseYawnumber
arcnumber
periodnumber
tnumber

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.