Combustion Engine
Internal combustion engine device with torque curves, starter motor, ignition control, and rev limiters. The primary power source for most vehicles in BeamNG.
Internal combustion engine device with torque curves, starter motor, ignition control, and rev limiters. The primary power source for most vehicles in BeamNG. Supports sub-modules for thermals, turbocharging, supercharging, and nitrous injection.
Inherited Methods
This device inherits all methods and properties from the Powertrain Base Device, such as :lockUp() and :disable().
Common Properties
| Property | Type | Description |
|---|---|---|
device.outputAV1 | number | Current angular velocity of the crankshaft in rad/s. Convert: RPM = outputAV1 * 9.549 |
device.engineLoad | number | Current engine load (0.0 to 1.0). |
device.isStalled | boolean | Whether the engine is currently stalled. |
device.isBroken | boolean | Whether the engine has suffered catastrophic failure. |
device.isDisabled | boolean | Whether the engine is disabled (e.g., out of fuel). |
device.combustionTorque | number | Torque from combustion alone (before friction and inertia). |
device.outputTorqueState | number | Master multiplier for final torque output (0.0 to 1.0+). Ideal for restrictors or power maps. |
device.torqueCurve | table | Base torque curve data. Modify in onInit for permanent power changes. |
Related Sub-Modules
| Sub-Module | Access | Reference |
|---|---|---|
| Thermals | device.thermals | Combustion Engine Thermals |
| Turbocharger | device.turbocharger | Turbocharger (if present) |
| Nitrous | device.nitrousOxide | Nitrous Oxide Injection (if present) |
Unit Conversions
- RPM to rad/s:
val * 0.104719755 - rad/s to RPM:
val * 9.549296596
Instance Methods
| Method | Signature | Description |
|---|---|---|
activateStarter | device:activateStarter() | Engages the engine starter motor. |
setIgnition | device:setIgnition(value) | Sets ignition state. value: 0 = Off, 1 = On. |
cutIgnition | device:cutIgnition(duration) | Momentarily cuts ignition for duration seconds. |
lockUp | device:lockUp() | Forcefully locks the engine (catastrophic failure). |
setTempRevLimiter | device:setTempRevLimiter(av, overshoot?) | Sets a temporary RPM limiter. av in rad/s. |
getTorqueData | device:getTorqueData() → table | Returns torque and power curve data for UI visualization. |
Constructor
| Function | Signature | Description |
|---|---|---|
new | (jbeamData) → device | Creates a new combustion engine device from JBeam configuration data. |
Usage Example
-- Get the engine device
local eng = powertrain.getDevice("mainEngine")
-- Start the engine
eng:setIgnition(1)
eng:activateStarter()
-- Read RPM
local rpm = eng.outputAV1 * 9.549
-- Momentary ignition cut for anti-lag effect
eng:cutIgnition(0.1)
-- Set a temporary rev limiter at 5000 RPM
eng:setTempRevLimiter(5000 * 0.1047, 100)
-- Get torque curve data for UI
local data = eng:getTorqueData()Architectural Tip: Override getTorqueData() to make dynamic power modifications visible in UI graphs. See the Modding Guide for a full example.
See Also
- Combustion Engine Thermals — Temperature and overheat simulation
- Turbocharger — Exhaust-driven forced induction
- Supercharger — Engine-driven forced induction
- Nitrous Oxide Injection — Chemical boost
- Powertrain Base Device — Inherited base methods
Centrifugal Clutch
Clutch that engages automatically based on rotational speed using centrifugal force. Commonly used in go-karts, mopeds, and small utility vehicles.
Combustion Engine Thermals
Advanced thermal simulation for combustion engines. Models coolant, oil, cylinder wall, and exhaust temperatures with realistic heat transfer, overheat damage, and component failure mechanics.