Physics Simple
App: apps/physics_simple/
A minimal physics demo: physics bodies are created automatically from Blender’s native Rigid Body settings when a .blend is instantiated. No Wren physics creation code is needed. The floor (static) and cube (dynamic) interact via Jolt.
Run from root
Section titled “Run from root”% ./plume3d physics_simpleor
Run from app directory
Section titled “Run from app directory”% ./../plume3d .What it does
Section titled “What it does”- Loads
Models/SimplePhysics.blendand instantiates four collections: GameCamera, GameLight, Environment (static floor), PhysicsCube (dynamic cube). - Physics bodies are automatically created from each object’s Rigid Body settings in Blender — no
Physics.addDynamicBoxcall needed. - Space — toggles physics pause/resume (
Physics.setSimulationPaused). - R — resets the cube position, zeroes velocity, and wakes it up (
Physics.setPosition,Physics.setLinearVelocity,Physics.activate). - Shadow mapping is enabled:
light.castsShadows = true,Graphics.setShadowMappingEnabled(true),Graphics.setShadowMapSize(2048).
game.toml
Section titled “game.toml”[Game]name = "physics_simple"version = "0.0.1"
[Window]width = 800height = 600resizable = true
[Physics]collision_layers = ["Default", "Floor", "Cubes"]collision_matrix = [[0,0], [0,1], [0,2], [1,2], [2,2]]Blend setup
Section titled “Blend setup”The blend must be created in Blender with the Plume3D addon. Key objects and their settings:
| Object | Class Name | Node Id | Rigid Body |
|---|---|---|---|
| Camera | GameCamera | main_camera | — |
| Light | GameLight | main_light | — |
| Ground plane | (in Environment collection) | — | Passive, Box |
| Falling cube | PhysicsCube | physics_cube | Active, Box |
Set Collision Layer to Floor on the ground and Cubes on the cube. Set Game Config Path to game.toml so the addon shows named collision layers.
- Physics —
setSimulationPaused,setPosition,setLinearVelocity,setAngularVelocity,activate. - Resource —
loadBlend(bodies auto-created on instantiate). - Graphics —
setLights,setShadowMappingEnabled,setShadowBias,setShadowMapSize. - Light —
castsShadows. - Scene, Node, Camera.
Expanding further
Section titled “Expanding further”- Add
Physics.onContactBeginto detect when the cube lands. - Add
Physics.addImpulseto let the player kick the cube. - Spawn more cubes with
Physics.addDynamicBoxin code.