What it does
physics
Physics tab for the System Tools inspector — body/collider counts,
world parameters (gravity, timestep), contacts. Pause toggles between
edit and play mode via wld.edit / wld.play; Reset re-loads the
active scene. Refreshes at 5 Hz from the engine-cached
getPhysicsDataTable().
Exports
M.build(_state) -> any— build the zui widget tree for the tab.M.onCallback(callbackId: string, _data, _state) -> boolean— handle pause/play toggle and Reset button.M.label: string— tab title.M.refresh: number— refresh cadence in seconds (0.2).
Usage
local Physics = require("@builtin::modules.engine.editor.system_tools.tabs.physics")
local widget = Physics.build(state)
Physics.onCallback("physics-pause-toggle", nil, state)
Notes
- The pause toggle reads
wld.mode()to decide the next action; pressing it flips edit ↔ play. - Reset calls
layers.active:reload()— it re-loads the same scene, dropping runtime mutations. - Flash messages (the inline status line) persist for ~4 s after each action; they are state local to the module.
Cache.invalidate("physics:snapshot")is fired after a pause toggle so the next refresh tick re-fetches.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.