Merged and optimized colliders are autogenerated for groups of objects when they define basic physical characteristics, allowing experimentation-friendly yet performant shape composition using groups of primitives or custom meshes.

Collision contact events are dispatched using the DOM-like event bubbling system that all other Troika events use, allowing for simple onContact-style event listener registration. Collisions are filtered to only objects that have active listeners, and are batched into a single Transferable object from the physics engine running in a Web Worker. Live example available here.

Soft volume support as simple as setting a boolean property and specifying a pressure value. The physics module extracts all of the shape's vertices automatically, and handles synchronization of their positions with the transferable payloads managed in the physics worker module. Physical properties like mass and pressure are subject to all of the other troika magic like CSS-style transitions with easing, and animations.

Update Apr. 2021: This module is currently under the knife for a full refactor using a different backing engine and SharedArrayBuffer, but an old buggy version is still live and available to demo here.

You may also like

Back to Top