ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. calculateEngineHandling

Function

calculateEngineHandling

Server and clientVehiclesTrilogy Hub only

Calculates which handling fields an engine would give in a model, without fitting it. It returns what setVehicleEngine would write into the vehicle, so it suits a preview in an engine shop.

Syntax

table calculateEngineHandling(int model, table spec [, float wear = 0, float extraMass = 0])

Arguments

modelint
Vehicle model ID.
spectable
Engine table as in setVehicleEngine.
wearfloat, optional = 0
Wear 0..1.
extraMassfloat, optional = 0
Extra vehicle mass in kg (e.g. cargo).

Returns

Fields mass, turnMass, maxVelocity, engineAcceleration, engineInertia, engineType, numberOfGears, tractionMultiplier.

Example

local h = calculateEngineHandling(411, { power = 400 }, 0, 150)
outputDebugString("Vmax po swapie: " .. h.maxVelocity)

See also