Ground Model Debug
ImGui-based debug tool for visualizing and editing ground model physics properties in real time.
ImGui-based debug tool for visualizing and editing ground model physics properties in real time.
Overview
util_groundModelDebug provides a comprehensive debug window for ground models (surface physics materials). Displays a color-coded overlay of ground types, allows live editing of friction/fluid parameters, and supports collision density visualization. Uses ImGui for the UI and debugDrawer for 3D rendering.
Extension path: lua/ge/extensions/util/groundModelDebug.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
openWindow | () | Opens the debug window. |
onUpdate | (dt) | Renders debug overlays and the ImGui window. |
onExtensionLoaded | () | Initializes ground model data from core_environment. |
onSerialize | () | Saves window/debug state for hot-reload. |
onDeserialized | (data) | Restores state after hot-reload. |
Internals
Ground Model Properties (Editable)
Each ground model exposes sliders for:
| Property | Range | Description |
|---|---|---|
collisiontype | 0–30 | Collision type index. |
defaultDepth | 0–5 | Surface fluid depth (meters). |
dragAnisotropy | 0–1 | Vertical drag anisotropy (lift/sink effect). |
flowBehaviorIndex | 0–5 | Pseudoplastic (<1) / Newtonian (1) / Dilatant (>1). |
flowConsistencyIndex | 0–15000 | Speed-sensitive drag coefficient. |
fluidDensity | 0–50000 | Surface fluid density (kg/m³). |
hydrodynamicFriction | 0–0.01 | Speed-sensitive friction for fluid-like surfaces. |
roughnessCoefficient | 0–1 | Surface roughness. |
shearStrength | 0–25000 | Material shear strength. |
skidMarks | bool | Whether skid marks are rendered. |
slidingFrictionCoefficient | 0.1–1.5 | Kinetic friction. |
staticFrictionCoefficient | 0.1–2.0 | Static friction. |
strength | 0–2 | Generic friction multiplier. |
stribeckVelocity | 0–7.5 | Static-to-sliding friction transition shape. |
Debug Modes
| Mode | Description |
|---|---|
| Ground | Color-coded ground model type overlay. |
| Depth | Surface depth visualization. |
| Static | Static collision geometry debug. |
| Coltris/m² | Collision triangle density heatmap. |
Visualization Options
- Mouse Focus: Raycast from mouse to set debug center point.
- Distance: Render radius (0–60 units).
- Tile Size: Debug grid tile size (0.5–1.0).
- Depth Scale: Depth visualization multiplier.
Collision Density
When enabled, renders a tile grid showing collision triangle density:
- Configurable tile count, size, and color threshold.
- Optional text labels showing per-tile counts.
Persistence
Settings (colors, options) are saved to settings/editor/groundModelDebug_settings.json.
How It Works
- Call
openWindow()or load the extension. - The ImGui window shows all ground models with toggleable visibility and color pickers.
- Expand any ground model to edit its physics properties live via
be:setGroundModel(). - Changes propagate to aliases automatically.
- Use the menu to save modified ground models or restore defaults.
Lua Examples
-- Open the debug window
extensions.util_groundModelDebug.openWindow()
-- The window provides:
-- - Toggle visibility per ground model
-- - Color-code customization
-- - Live physics parameter editing
-- - Save/restore ground modelsAdditional Exports
M.onDeserialized- (undocumented)M.onExtensionLoaded- (undocumented)M.onSerialize- (undocumented)M.onUpdate- (undocumented)M.openWindow- (undocumented)
Forest Generator
Procedural forest generation utility for creating, querying, updating, and deleting forest items programmatically.
Input System Utils
Utilities for analyzing and re-formatting input map JSON files. Prints binding statistics and resaves all inputmap files with consistent formatting and sorting.