GetElementDistanceFromCentreOfMassToBaseOfModel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Added OOP variable)
Line 6: Line 6:
float getElementDistanceFromCentreOfMassToBaseOfModel ( element theElement )
float getElementDistanceFromCentreOfMassToBaseOfModel ( element theElement )
</syntaxhighlight>
</syntaxhighlight>
{{OOP|This function is also a static function underneath the Element class.|[[element]]:getDistanceFromCentreOfMassToBaseOfModel||}}
{{OOP|This function is also a static function underneath the Element class.|[[element]]:getDistanceFromCentreOfMassToBaseOfModel|distanceFromCentreOfMassToBaseOfModel}}


===Required Parameters===
===Required Parameters===

Revision as of 13:34, 31 December 2014

This function is used to retrieve the distance between a element's centre of mass to the base of the model. This can be used to calculate the position the element has to be set to, to have it on ground level.

Syntax

float getElementDistanceFromCentreOfMassToBaseOfModel ( element theElement )

OOP Syntax Help! I don't understand this!

Note: This function is also a static function underneath the Element class.
Method: element:getDistanceFromCentreOfMassToBaseOfModel(...)
Variable: .distanceFromCentreOfMassToBaseOfModel


Required Parameters

theElement: The element you want to retrieve the value of.

Returns

Returns a float with the distance, or false if the element is invalid.

Example

This example outputs the value for the local player.

local localPlayer = getLocalPlayer()
local distance = getElementDistanceFromCentreOfMassToBaseOfModel(localPlayer)
outputChatBox(tostring(distance))

See Also