Kinematic bodies, inactive GameObjects, and a disabled body is not written back (#72) #104

Merged
crowmaki merged 2 commits from issue-72-kinematic-inactive-bodies into main 2026-09-07 00:39:36 +00:00
Owner

Closes #72. Part of #67.

What

  • A kinematic Rigidbody hands its owner's World Transform to Box3D through Body_SetTargetTransform before each step and is never written back, so the Scene API is the authority for where it is and a dynamic cube resting on it is carried by contact.
  • A Rigidbody whose owner is not Active in Hierarchy has its body disabled before the step it is first seen inactive and enabled again when seen active. A disabled body is skipped by the write-back.
  • Rigidbody.on_add honours an authored body_type; only the zero value (Static) is coerced to Dynamic, as before.
  • Box_Collider friction defaults to Box3D's 0.6 when zero, the way density already does. Without it nothing rides a moving platform. ADR-0016's dated note records this alongside the kinematic and inactive behaviour.

Collider migration onto a new Rigidbody (the third criterion) was implemented in #71 and its test still passes unchanged.

Tests

tests/core/box3d_plugin_test.odin, all Headless: a kinematic platform moved each step through the Scene API is exactly where it was put and carries a rested cube; deactivating a falling cube's ancestor freezes its World Transform bit-for-bit and reactivating resumes the fall; an inactive Rigidbody lets a cube fall through it.

Deviations from the issue wording

  • Kinematic bodies are moved by target velocity rather than teleported, so a resting body is carried by friction. The GameObject is not written back for kinematic bodies, which is what makes "where it was put" exact.
  • A static Rigidbody still has no spelling, since Body_Type's zero is Static and on_add reads zero as Dynamic.

Verification

just check passes. Core suite 363 tests, platform, vulkan_backend, imgui and luau suites all pass. The two shaderc tests fail on main too (locally stale committed shader output); unrelated.

Closes #72. Part of #67. ## What - A kinematic `Rigidbody` hands its owner's World Transform to Box3D through `Body_SetTargetTransform` before each step and is never written back, so the Scene API is the authority for where it is and a dynamic cube resting on it is carried by contact. - A `Rigidbody` whose owner is not Active in Hierarchy has its body disabled before the step it is first seen inactive and enabled again when seen active. A disabled body is skipped by the write-back. - `Rigidbody.on_add` honours an authored `body_type`; only the zero value (Static) is coerced to Dynamic, as before. - `Box_Collider` friction defaults to Box3D's 0.6 when zero, the way density already does. Without it nothing rides a moving platform. ADR-0016's dated note records this alongside the kinematic and inactive behaviour. Collider migration onto a new `Rigidbody` (the third criterion) was implemented in #71 and its test still passes unchanged. ## Tests `tests/core/box3d_plugin_test.odin`, all Headless: a kinematic platform moved each step through the Scene API is exactly where it was put and carries a rested cube; deactivating a falling cube's ancestor freezes its World Transform bit-for-bit and reactivating resumes the fall; an inactive `Rigidbody` lets a cube fall through it. ## Deviations from the issue wording - Kinematic bodies are moved by target velocity rather than teleported, so a resting body is carried by friction. The GameObject is not written back for kinematic bodies, which is what makes "where it was put" exact. - A static `Rigidbody` still has no spelling, since `Body_Type`'s zero is Static and `on_add` reads zero as Dynamic. ## Verification `just check` passes. Core suite 363 tests, platform, vulkan_backend, imgui and luau suites all pass. The two shaderc tests fail on `main` too (locally stale committed shader output); unrelated.
A kinematic Rigidbody hands its owner's World Transform to Box3D as a
target before each step and is never written back, so the Scene API is
the authority for where it is and a dynamic cube resting on it is carried.
A Rigidbody whose owner is not Active in Hierarchy has its body disabled
before the step and enabled again when the owner returns. Box_Collider
friction defaults to Box3D's 0.6 when authored as zero, the way density
already does; without it nothing rides a moving platform.

Collider migration onto a new Rigidbody was already covered by #71 and its
test.
crowmaki deleted branch issue-72-kinematic-inactive-bodies 2026-09-07 00:39:36 +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!104
No description provided.