ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. getElementDistanceFromCentreOfMassToBaseOfModel

Function

getElementDistanceFromCentreOfMassToBaseOfModel

ClientElementsIdentical to MTA:SA

Returns the distance from the element's centre of mass to the bottom of its model. Useful for placing elements on the ground.

Syntax

float getElementDistanceFromCentreOfMassToBaseOfModel(element theElement)

Arguments

theElementelement
The element.

Returns

Distance in metres.

Example

local base = getElementDistanceFromCentreOfMassToBaseOfModel(vehicle)
local x, y = getElementPosition(vehicle)
local ground = getGroundPosition(x, y, 100)
outputChatBox(("Auto powinno stać na Z = %.2f"):format(ground + base))