Controller Template
A boilerplate template for creating new custom vehicle controllers. Copy this file as a starting point when developing a new controller module. It demonstrates the standard lifecycle hooks, state management, and API patterns.
A boilerplate template for creating new custom vehicle controllers. Copy this file as a starting point when developing a new controller module. It demonstrates the standard lifecycle hooks, state management, and API patterns.
Hooks
| Hook | Description |
|---|---|
init(jbeamData) | Primary initialization hook called when the vehicle is created. |
reset(jbeamData) | Reset hook called when the vehicle is reset. |
updateGFX(dt) | Main logic hook for user-facing systems, running at the UI/frame rate. |
updateFixedStep(dt) | High-frequency hook for physics-sensitive logic (e.g., torque application). |
Usage Example
-- Copy this template and rename to create a new controller:
-- 1. Copy controllerTemplate.lua to myController.lua
-- 2. Update the controller name and JBeam references
-- 3. Implement your logic in updateGFX/updateFixedStepSee Also
- Controller Overview — Directory of all controllers
- Logger Template — Template for data logging controllers
Bypass Dampers Controller
Manages position-sensitive bypass shock absorbers that change damping characteristics based on shaft position. Used on off-road vehicles for progressive damping — soft for small bumps, firm for large impacts.
Control Modes
Manages multiple input mapping profiles that change how physical controls are interpreted. Each mode can remap, scale, and smooth input axes differently — useful for vehicles with multiple operating modes (e.g., crane vs. drive mode on utility vehicles).