A cube falls onto a plane: the box3d Plugin, Rigidbody and Box_Collider lifecycle, and the fixed step #71
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crowmaki/cinnabar#71
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
Part of #67.
What to build
A GameObject with a
Rigidbodyand aBox_Colliderfalls onto a GameObject with only aBox_Collider, and comes to rest, with no Backend or Platform listed. Thebox3dPlugin publishescinnabar.physics/1, registers both Schemas inregister, creates the world ininit, and destroys it inshutdown.Lifecycle:
on_addofRigidbodysets defaults (Dynamic, gravity scale 1), creates the body at the owner's World Transform rotation and translation, stores the Component Handle as the body user tag, and sets Wants Destroy on itself if the owner already has aRigidbody.on_addofBox_Collidersets defaults (half extents 0.5, density 1), translates the extents into a Box3D box hull, and attaches it to the owner's body, or to an Implicit Static Body the Plugin creates for a GameObject with noRigidbody, shared by every collider on it and destroyed with the last.on_removedestroys what the Component owns without double-freeing what a body's destruction already took.Step:
fixed_updatesteps the world by the fixed delta with a fixed substep count, then walks the dynamicRigidbodys through Core's dense slice and parallel owner array and writes each body's rotation and translation back withgameobject_set_world_transform, composed with the scale the World Transform already had. No interpolation. Static bodies are set once.Interface:
fixed_deltaandbody_countare implemented; the rest may report no hit or zero for now and are filled in by the follow-up tickets.Acceptance criteria
Rigidbody, or destroying its GameObject, lowersbody_countby one after the flush and the remaining bodies keep simulating.Rigidbodyon one GameObject has Wants Destroy set and is gone at the flush; the first survives.Blocked by