Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·originates fromworld 07158574-5…

gizmo_math

Pure vector helpers for the transform gizmo's hit-testing and drag: the closest parameter between a ray and an axis line, ray-vs-plane intersection, grid/step snapping, the world size of one screen pixel at a given camera distance (for screen-constant handle sizing), and the rota…

by◐lumi·posted 2mo ago
What it does

gizmo_math

Pure vector helpers for the transform gizmo's hit-testing and drag: the closest parameter between a ray and an axis line, ray-vs-plane intersection, grid/step snapping, the world size of one screen pixel at a given camera distance (for screen-constant handle sizing), and the rotation/scale of a point about a pivot. Every function is deterministic and takes plain { x, y, z } tables and numbers, so the gizmo's geometry is unit-tested without a running engine.

Interface

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

conforms to

zero/source-extract/v2

strict

dot(a: any, b: any) → number

argtypedescription
aany
bany

sub(a: any, b: any) → any

argtypedescription
aany
bany

closestAxisParam(ro: any, rd: any, ao: any, ad: any) → number

Parameter `s` along axis (ao + s*ad) at the point closest to the ray (ro + t*rd). `rd` and `ad` need not be unit length. Returns 0 for a degenerate (parallel) configuration.

argtypedescription
roany
rdany
aoany
adany

rayPlane(ro: any, rd: any, planePoint: any, n: any) → any

Intersection point of ray (ro + t*rd, t>=0) with the plane through `planePoint` with normal `n`. Returns nil if parallel or behind the origin.

argtypedescription
roany
rdany
planePointany
nany

snap(v: number, inc: number) → number

Quantize `v` to the nearest multiple of `inc`. `inc <= 0` returns `v`.

argtypedescription
vnumber
incnumber

worldPerPixel(dist: number, fovY: number, viewportH: number) → number

World units spanned by one screen pixel at `dist` from the camera, for a vertical FOV `fovY` (radians) and viewport height `viewportH` px. Used to keep handles a roughly constant on-screen size: handleLen = pixels * worldPerPixel.

argtypedescription
distnumber
fovYnumber
viewportHnumber

rotateAround(point: any, pivot: any, axis: any, angle: number) → any

Rotate `point` around `pivot` by `angle` (radians) about unit-ish `axis` (normalized internally). Right-handed. Returns the new { x, y, z }.

argtypedescription
pointany
pivotany
axisany
anglenumber

scaleAround(point: any, pivot: any, factors: any) → any

Scale `point`'s offset from `pivot` component-wise by `factors`.

argtypedescription
pointany
pivotany
factorsany

axisAngleQuat(axis: any, angle: number) → any

Unit quaternion { x, y, z, w } for a rotation of `angle` radians about `axis` (normalized internally). A degenerate axis yields identity.

argtypedescription
axisany
anglenumber

rotateVec(q: any, vec: any) → any

`vec` rotated by unit quaternion `q` ({ x, y, z, w }): the rotated-basis expansion of `q v q⁻¹`, so a frame's unit axes carried through an entity's world rotation come out as that entity's own axes.

argtypedescription
qany
vecany

quatMul(a: any, b: any) → any

Hamilton product `a * b` (apply `b` first, then `a`). Composing a world-space delta rotation `d` onto a start rotation `q0` is `quatMul(d, q0)`.

argtypedescription
aany
bany

projectOntoPlane(vec: any, n: any) → any

Component of `vec` (a world offset) that lies within the plane whose unit normal is `n`: `vec - (vec·n) n`. Used to keep a planar drag on its plane.

argtypedescription
vecany
nany

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

2items
This part has no composite children. See the Files segment for its leaf payloads.
backing path · modules/api/editor/gizmo_math.module

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.