GetElementDistanceFromCentreOfMassToBaseOfModel: Difference between revisions
Jump to navigation
Jump to search
LordAzamath (talk | contribs) (As the function is a client function, changed →See also: to client element functions) |
Fernando187 (talk | contribs) (Add note on element streamed in requirement) |
||
(7 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
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. | 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. | ||
{{Note|The distance value is only available when the element is streamed in, otherwise 0 is returned. If you create an element at the player's position which is going to be streamed in, call the function in the next frame to obtain the correct value (with setTimer 0ms, for example).}} | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
float getElementDistanceFromCentreOfMassToBaseOfModel ( element theElement ) | float getElementDistanceFromCentreOfMassToBaseOfModel ( element theElement ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[element]]:getDistanceFromCentreOfMassToBaseOfModel|distanceFromCentreOfMassToBaseOfModel}} | |||
===Required Parameters=== | ===Required Parameters=== | ||
'''theElement:''' The element you want to retrieve the value of. | '''theElement:''' The element you want to retrieve the value of. | ||
===Returns=== | ===Returns=== | ||
Returns a ''float'' with the distance, or ''false'' if the element is invalid. | Returns a ''float'' with the distance, or ''false'' if the element is invalid. | ||
==Example== | ==Example== | ||
This example outputs the value for the local player. | This example outputs the value for the local player. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local distance = getElementDistanceFromCentreOfMassToBaseOfModel(localPlayer) | local distance = getElementDistanceFromCentreOfMassToBaseOfModel(localPlayer) | ||
outputChatBox(tostring(distance)) | outputChatBox(tostring(distance)) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Client element functions}} | {{Client element functions}} |
Latest revision as of 21:22, 8 December 2023
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!
- 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 distance = getElementDistanceFromCentreOfMassToBaseOfModel(localPlayer) outputChatBox(tostring(distance))
See Also
- getElementBoneMatrix
- getElementBonePosition
- getElementBoneRotation
- getElementBoundingBox
- getElementDistanceFromCentreOfMassToBaseOfModel
- getElementLighting
- getElementRadius
- isElementCollidableWith
- isElementLocal
- isElementOnScreen
- isElementStreamable
- isElementStreamedIn
- isElementSyncer
- isElementWaitingForGroundToLoad
- setElementBoneMatrix
- setElementBonePosition
- setElementBoneRotation
- setElementCollidableWith
- setElementStreamable
- updateElementRpHAnim
- Shared
- attachElements
- createElement
- destroyElement
- detachElements
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementByIndex
- getElementByID
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getAllElementData
- hasElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementType
- getElementVelocity
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementWithinColShape
- isElementWithinMarker
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementVelocity
- setLowLODElement
- getPedContactElement
- getResourceDynamicElementRoot
- getResourceRootElement