How stink-o/box3d-godot works
Box3D for Godot embeds the Box3D rigid-body engine as a Godot 4 GDExtension. A project author configures world, body, collider and joint nodes; the binding creates and steps an engine world, then exposes simulation state and events back to Godot. The documented product also includes spatial queries, character control, recording/replay, editor gizmos and a browser demo. The tree and excerpts support the core engine/binding links; demo details beyond the listed generators are based on README capabilities.
Main entry points: box3d.h Engine public API · box3d_world.cpp World node · physics_world.c World simulation · box3d_body.cpp Body node
Components 19
Godot binding
- Extension registration
godot/src/register_types.cpp - World node
godot/src/box3d_world.cpp - Body node
godot/src/box3d_body.cpp - Collision shapes
godot/src/box3d_collision_shape.cpp - Joint nodes
godot/src/box3d_joint.cpp - Character controller
godot/src/box3d_character.cpp - Contact rules
godot/src/box3d_contact_rules.cpp
Physics engine
- Engine public API
include/box3d/box3d.h - World simulation
src/physics_world.c - Collision detection
src/broad_phase.c - Constraint solver
src/solver.c - Spatial queries
src/physics_world.c
Replay and editor
- Recording
src/recording.c - Replay player
src/recording_replay.c - Godot replay
godot/src/box3d_replay.cpp - Editor gizmos
godot/src/box3d_editor_gizmos.cpp
Demo samples
- Demo samples
godot/demo/tools - Demo scene setup
godot/demo/tools/gen_main.py
Other components
- Godot project author
Connections 20
- Godot project author → Extension registration: loads extension
- Godot project author → World node: configures scene
- World node → Engine public API: creates and steps
- Body node → Engine public API: creates bodies
- Collision shapes → Engine public API: creates shapes
- Joint nodes → Engine public API: creates joints
- Character controller → Engine public API: controls movement
- Contact rules → Engine public API: sets contact rules
- Engine public API → World simulation: dispatches calls
- World simulation → Collision detection: finds contacts
- World simulation → Constraint solver: solves constraints
- World node → Spatial queries: runs queries
- World simulation → World node: provides events
- World node → Body node: syncs state
- World simulation → Recording: records state
- Recording → Replay player: replays recording
- Godot replay → Replay player: controls playback
- Godot project author → Editor gizmos: views editor guides
- Demo scene setup → World node: configures demo world
- Demo samples → Demo scene setup: generates samples