GetElementPosition: Difference between revisions
Jump to navigation
Jump to search
m (→Example) |
|||
Line 14: | Line 14: | ||
==Example== | ==Example== | ||
This example spawns a Landstalker and creates a weapon pickup at it's position. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- create a landstalker, and store it's reference in the variable called 'myLandstalker' | -- create a landstalker, and store it's reference in the variable called 'myLandstalker' |
Revision as of 08:13, 1 August 2007
An Element is anything which has been defined or can be retrieved from Lua. The getElementPosition function allows you to retrieve the location of any element.
Syntax
float, float, float getElementPosition ( element theElement )
Required Arguments
- theElement: The element in which you'd like to retrieve the location of
Returns
Returns three floats indicating the position of the element, x, y and z respectively.
Example
This example spawns a Landstalker and creates a weapon pickup at it's position.
-- create a landstalker, and store it's reference in the variable called 'myLandstalker' myLandstalker = createVehicle ( 400, 1591.596680, -2495.323242, 18.098244 ) -- Create a weapon pickup at the vehicle's position createPickup ( getElementPosition ( myLandstalker ), 2, 31 )
This example attaches a samsite on the players vehicle.
-- create the elegy; vehicle = getPlayerOccupiedVehicle ( 562, 1591.596680, -2495.323242, 18.098244 ) -- get the vehicles position; local x,y,z = getElementPosition(vehicle) -- Create the samsite; samsite = createObject ( 3267, x, y, z + 3 ) -- attach the samsite to the elegy; attachElementToElement ( samsite, vehicle, 0, 0, 0 )
See Also
- 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