Player Controller
The main controller for the walking/unicycle character mode. Manages movement physics using PID-based stabilization on a ball, handles jumping, crouching, and camera-relative directional input. Provides compatibility variables for dashboard UI elements.
The main controller for the walking/unicycle character mode. Manages movement physics using PID-based stabilization on a ball, handles jumping, crouching, and camera-relative directional input. Provides compatibility variables for dashboard UI elements.
State Fields
| Field | Type | Description |
|---|---|---|
fireEngineTemperature | number | Dummy value for compatibility with dashboard clusters. |
throttle, brake, clutchRatio | number | Processed control inputs. |
engineInfo | table | Standard telemetry buffer for UI clusters. |
ignition | boolean | Internal status flag. |
isEngineRunning | number | Movement status (1 if moving or ready). |
Public API
| Function | Description |
|---|---|
walkLeftRight(value) | Manages movement direction based on camera rotation. |
jump(value) | Triggers a high-force impulse to launch the player into the air. |
crouch(value) | Manages height reduction by adjusting internal beam lengths and pressures. |
setFreeze(mode) | Disables all movement inputs. |
module.setCameraControlData(controlData) | Sets the camera control data. |
Hooks
| Hook | Description |
|---|---|
init(jbeamData) | Identifies stabilization nodes and beams, and sets up ball physics parameters. |
updateFixedStep(dt) | primary stabilization and propulsion loop. Calculates PID-based forces to keep the player upright and applies torque to the ball for movement. |
updateGFX(dt) | Handles state transitions like crouching and updates UI electrics. |
module.initLastStage() | Final-stage initialization after all controllers and powertrains are ready. |
module.reset() | Resets the controller to its initial state. |
module.settingsChanged() | Called when vehicle settings change. |
module.onDeserialize(data) | Restores state from serialized data. |
module.onSerialize() | Serializes state for saving. |
module.nodeCollision(p) | take a look at physics particles and use the node and slip velocities to estimate a ball center velocity that is local to the unicycle |
Usage Example
-- Movement is handled via input actions (WASD)
-- Jump
controller.getController("playerController").jump(1)
-- Toggle crouch
controller.getController("playerController").toggleCrouch()
-- Freeze movement
controller.getController("playerController").setFreeze(1)See Also
- Vehicle Controller — Main vehicle controller
- Dummy Controller — Minimal controller alternative
Nitrous Oxide Injection
Controls nitrous oxide (NOS/N2O) injection systems that provide temporary power boosts by enriching the combustion mixture with additional oxygen. Manages bottle pressure, solenoid activation, fuel enrichment, and injection timing.
Pneumatics System Controller
Top-level controller for vehicle pneumatic (air pressure) systems. Manages air compressors, pressure tanks, valves, and pneumatic actuators. Provides the foundation for air brakes, air suspension, and other pneumatic subsystems.