Log inGet started
What it does

entity_proxy

Entity proxy metatable layer. Replaces the per-call closure-pushing entity proxy (push_entity_proxy in crates/zero_scripting/src/ffi_callbacks.rs) with a thin Luau metatable that calls into the __native_transform.* / __native_entity.* flat FFI bindings. The user-facing API is unchanged: entity(id).localPosition = { x, y, z }, entity(id).despawn(), entity(id).name, etc. all still work.

After warm-up, steady-state allocation is zero: same id returns the same proxy (weak-valued cache), sub-proxies are lazily allocated once and cached on the proxy, and each method binding is a closure created on first access and cached as __m_<name>.

Exports

  • M.build(id: string) -> any — entity proxy factory. Returns a cached proxy when one exists; otherwise allocates and caches a fresh one. Also bound as _G.__build_entity_proxy for the Rust-side push_entity_proxy call.
  • M.EntityProxyMT, M.PositionProxyMT, M.RotationProxyMT, M.LocalPositionProxyMT, M.LocalRotationProxyMT, M.LocalScaleProxyMT, M.LossyScaleProxyMT, M.TransformProxyMT, M.AttributeProxyMT — exported metatables; consumers that want to extend the proxies can read them, but the proxies are sealed externally (every __newindex errors).

Usage

local EntityProxy = require("@builtin::modules.entity_proxy")

local proxy = EntityProxy.build("some-entity-id")
proxy.localPosition = { 0, 1, 2 }
proxy.localRotation.eulerAngles = { 0, 90, 0 }
print(proxy.name)
proxy.despawn()

Notes

  • World vs local space (post Bevy hierarchy migration):
    • .position / .rotation are world-space — engine back-computes Transform.{translation, rotation} on set, decomposes the world matrix on get.
    • .localPosition / .localRotation / .localScale are parent-relative direct reads/writes on Transform.*.
    • .lossyScale is read-only world-space scale (approximate under non-uniform parent scale + rotation; mirrors Unity).
    • .worldMatrix() answers the whole composed object-to-world matrix as 16 column-major numbers, translation in elements 13, 14, 15 — the placement the renderer draws the entity's geometry at, carrying the skew a decomposition into position / rotation / scale folds away. Also readable as .transform.worldMatrix().
    • Bare .scale was removed — accessing it raises an error pointing callers at localScale / lossyScale.
  • Sealed proxies: every proxy errors on __newindex (sealing). Mutations go through position.set / attribute.set / etc., not direct field writes.
  • Caching: the entity-proxy cache is keyed by id with weak values (__mode = "v"), so dropped proxies are GC'd. Within one proxy, the M_PREFIX-keyed cache survives until the proxy itself is collected.
  • The .component sub-proxy is built by __native_entity.component_subproxy — Rust-side helper that constructs the ~15-closure component-proxy table once per entity. Subsequent .component accesses hit the cached entry.

Interface

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

This asset doesn't declare a schema or structured payload.

Sub-parts

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

0items
This part has no composite children. See the Files segment for its leaf payloads.
This part has no leaf payloads.

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.