Axiom/Docs
Capability catalog / entity.transform

entity.transform

@1ALL BACKENDS

Positions, rotations and scales of live entities. Reads are automatic. Writing a transform needs memory.write, which is prompted at install.

Requires entity.query@1·4 calls, 2 with a bulk form·Since core 0.1.0

Types

TYPESgenerated from the IDL
struct Vec3 { x: f32, y: f32, z: f32 }

struct Transform {
  position: Vec3,
  rotation: Vec3,
  scale:    Vec3,
}

Calls

positionsBULKautomatic
bulk fn positions(e: []EntityId) -> []Vec3

World positions for a set of entities, in one crossing. The returned array matches the input order. An entity that no longer resolves yields a zero vector rather than shifting the array, so indices stay aligned.

Parameters
eThe entities to read. Up to 4096 per call.
Returns
[]Vec3One per input, same order.
positionautomatic
fn position(e: EntityId) -> Vec3

The world position of one entity.

Calling this in a loop inside on_frame is one boundary crossing per entity. The linter warns and names positions as the fix.

transformBULKautomatic
fn transform(e: EntityId) -> Transform

Position, rotation and scale together. Cheaper than three calls, and consistent: all three come from the same instant.

set_positionNEEDS MEMORY.WRITE
fn set_position(e: EntityId, p: Vec3) -> Result<(), Denied>

Moves an entity. Returns Err(Denied) if the mod did not declare memory.write, every time, at every call site. The denial is logged once per session, not once per call.

Errors
DeniedThe capability was not declared
Failed(NoSuchEntity)The handle no longer resolves

Example

// one crossing for every entity on screen
auto ids = f.entities().alive();
auto pts = f.entities().positions(ids);

markers_.clear();
for (auto const& p : pts)
  if (auto s = f.camera().project(p))
    markers_.push_back(*s);