Physics Stack
App: apps/physics_stack/
Demonstrates automatic rigid body stacking: a tower of dynamic cubes on a static floor, with contact events logged to the console when cubes collide. Bodies are created automatically from Blender’s Rigid Body settings on instantiation — no Physics.addDynamicBox calls needed.
Run from root
Section titled “Run from root”% ./plume3d physics_stackWhat it does
Section titled “What it does”- Loads
Models/StackDemo.blendand instantiates GameCamera, GameLight, Environment (static floor), and stacked Cubes (dynamic rigid bodies). - Registers
Physics.onContactBeginto log every collision pair and contact point. - Shadow mapping enabled:
light.castsShadows = true,Graphics.setShadowMappingEnabled(true),Graphics.setShadowMapSize(2048).
Contact event registration
Section titled “Contact event registration”Physics.onContactBegin(_scene) { |nodeA, nodeB, px, py, pz, nx, ny, nz| Logger.info("Contact: %(nodeA.name) <-> %(nodeB.name) at (%(px), %(py), %(pz))")}Blend setup
Section titled “Blend setup”Create Models/StackDemo.blend in Blender with the Plume3D addon:
| Object | Class | Collision Layer | Rigid Body |
|---|---|---|---|
| Floor plane | in Environment collection | Floor | Passive, Box |
| Stacked cubes | StackedCubes collection | Boxes | Active, Box |
| Camera | GameCamera | — | — |
| Light | GameLight | — | — |
game.toml
Section titled “game.toml”[Physics]collision_layers = ["Default", "Floor", "Boxes"]collision_matrix = [[0,0], [0,1], [0,2], [1,2], [2,2]]