go.transform: position, localPosition, localMatrix, worldMatrix (#75) #84

Closed
opened 2026-09-06 01:25:28 +00:00 by crowmaki · 0 comments
Owner

Parent

#75

What to build

Moving something from a Script is one line. go.transform is a small userdata bound to the same GameObject Handle. position and localPosition read and write as {x, y, z} tables and are the translation column of the World Transform and the local transform; writing them replaces only that column and goes through gameobject_set_world_transform or gameobject_set_local_transform. worldMatrix and localMatrix read and write as the full sixteen numbers. Rotation and scale helpers are out of scope; the matrix is the escape hatch.

Acceptance criteria

  • Writing go.transform.localPosition = {1, 2, 3} is visible via gameobject_local_transform, and only the translation column changed
  • Writing go.transform.position under a parented GameObject is visible via gameobject_world_transform and the local transform is recomputed accordingly
  • Reading position and localPosition returns tables with x, y, z matching Odin
  • worldMatrix and localMatrix round-trip sixteen numbers in Mat4 column-major order
  • Writing a malformed table (missing component, wrong length) raises an error naming the property
  • go.transform on a dead GameObject raises

Blocked by

## Parent #75 ## What to build Moving something from a Script is one line. `go.transform` is a small userdata bound to the same GameObject Handle. `position` and `localPosition` read and write as `{x, y, z}` tables and are the translation column of the World Transform and the local transform; writing them replaces only that column and goes through `gameobject_set_world_transform` or `gameobject_set_local_transform`. `worldMatrix` and `localMatrix` read and write as the full sixteen numbers. Rotation and scale helpers are out of scope; the matrix is the escape hatch. ## Acceptance criteria - [ ] Writing `go.transform.localPosition = {1, 2, 3}` is visible via `gameobject_local_transform`, and only the translation column changed - [ ] Writing `go.transform.position` under a parented GameObject is visible via `gameobject_world_transform` and the local transform is recomputed accordingly - [ ] Reading `position` and `localPosition` returns tables with `x`, `y`, `z` matching Odin - [ ] `worldMatrix` and `localMatrix` round-trip sixteen numbers in Mat4 column-major order - [ ] Writing a malformed table (missing component, wrong length) raises an error naming the property - [ ] `go.transform` on a dead GameObject raises ## Blocked by - #82
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
crowmaki/cinnabar#84
No description provided.