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

Merged
crowmaki merged 2 commits from luau-transform-84 into main 2026-09-06 05:49:29 +00:00
Owner

Closes #84. Part of #75.

What

go.transform is a Transform userdata bound to the same GameObject Handle, cached per Handle in a weak table like the GameObject and Component userdata.

  • position and localPosition read as {x, y, z} tables and write from either {1, 2, 3} or {x = 1, y = 2, z = 3}. A write replaces only the translation column and goes through gameobject_set_world_transform or gameobject_set_local_transform.
  • worldMatrix and localMatrix read and write sixteen numbers in Mat4 column-major order.
  • A short, long, non-numeric or non-table value raises naming the property. Any read or write through a destroyed GameObject raises naming the operation, including go.transform itself.
  • The shared run_awake test helper moved into tests/luau/harness.odin.

One reading to confirm

The issue says positions "read and write as {x, y, z} tables". Reads answer keyed tables, so writes accept the keyed form too: a.transform.position = b.transform.position works, and the "missing component" acceptance criterion is what a keyed table with no z produces.

Tests

tests/luau/transform_test.odin covers every acceptance criterion from Luau source strings, checked against gameobject_local_transform and gameobject_world_transform.

just check and just test pass (449 tests).

Closes #84. Part of #75. ## What `go.transform` is a Transform userdata bound to the same GameObject Handle, cached per Handle in a weak table like the GameObject and Component userdata. - `position` and `localPosition` read as `{x, y, z}` tables and write from either `{1, 2, 3}` or `{x = 1, y = 2, z = 3}`. A write replaces only the translation column and goes through `gameobject_set_world_transform` or `gameobject_set_local_transform`. - `worldMatrix` and `localMatrix` read and write sixteen numbers in Mat4 column-major order. - A short, long, non-numeric or non-table value raises naming the property. Any read or write through a destroyed GameObject raises naming the operation, including `go.transform` itself. - The shared `run_awake` test helper moved into `tests/luau/harness.odin`. ## One reading to confirm The issue says positions "read and write as `{x, y, z}` tables". Reads answer keyed tables, so writes accept the keyed form too: `a.transform.position = b.transform.position` works, and the "missing component" acceptance criterion is what a keyed table with no `z` produces. ## Tests `tests/luau/transform_test.odin` covers every acceptance criterion from Luau source strings, checked against `gameobject_local_transform` and `gameobject_world_transform`. `just check` and `just test` pass (449 tests).
Closes #84. Part of #75.

`go.transform` is a Transform userdata bound to the same GameObject Handle,
cached in a weak table like the GameObject and Component userdata.

- `position` and `localPosition` read as `{x, y, z}` tables and write from
  either `{x, y, z}` or `{x =, y =, z =}`. A write replaces only the
  translation column and goes through the World or local transform setter.
- `worldMatrix` and `localMatrix` read and write sixteen numbers in Mat4
  column-major order.
- A short, long, non-numeric or non-table value raises naming the property.
  Reading or writing through a dead GameObject raises naming the operation.
crowmaki deleted branch luau-transform-84 2026-09-06 05:49:29 +00:00
Sign in to join this conversation.
No reviewers
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!96
No description provided.