setElementRotation
Client-side
Server-side
Shared
Pair: getElementRotation
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
Sets the rotation of elements according to the world (does not work with players that are on the ground).
Note
This function does not work on colshape .
Note
This function does not work on dummy element .
Tip
New scripts should set conformPedRotation to true when using this function on peds . This will prevent quirky old behaviour.
OOP Syntax Help! I don't understand this!
- Method:element:setRotation(...)
- Variable: .rotation
Syntax
bool setElementRotation ( element theElement, float rotX, float rotY, float rotZ, [ string rotOrder = "default", bool conformPedRotation = false ] )Required Arguments
- theElement: The element whose rotation will be set
- rotX: The element's rotation around the x axis in degrees
- rotY: The element's rotation around the y axis in degrees
- rotZ: The element's rotation around the z axis in degrees
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.
- rotOrder (default: "default"): A string representing the rotation order desired when interpreting the provided euler angles . If omitted, default value is "default" . Allowed values are: "default": default MTA behavior prior to 1.1, where rotation order depends on element type "ZXY": rotation about the Z axis ( up ), then about the resulting X axis ( right ), and finally about the resulting Y axis ( front ). This is the default rotation order for objects "ZYX": rotation about the Z axis ( up ), then about the resulting Y axis ( front ), and finally about the resulting X axis ( right ). This is the default rotation order for vehicles
- conformPedRotation (default: false): MISSING_PARAM_DESC
Returns
- bool: value
Returns true if the element rotation was successfully set and false otherwise.
Code Examples
shared
function pedRotate ( ) local rotX, rotY, rotZ = getElementRotation(localPlayer) -- get the local players's rotation setElementRotation(localPlayer,0,0,rotZ+10,"default",true) -- turn the player 10 degrees clockwiseendaddCommandHandler ( "turn", pedRotate )See Also
Element Functions
- addElementDataSubscriber
- attachElements
- clearElementVisibleTo
- cloneElement
- createElement
- destroyElement
- detachElements
- getAllElementData
- getAttachedElements
- getElementAlpha
- getElementAngularVelocity
- getElementAttachedOffsets
- getElementAttachedTo
- getElementBonePosition
- getElementBoneQuaternion
- getElementBoneRotation
- getElementBoundingBox
- getElementByID
- getElementByIndex
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getElementDimension
- getElementDistanceFromCentreOfMassToBaseOfModel
- getElementHealth
- getElementID
- getElementInterior
- getElementLighting
- getElementModel
- getElementParent
- getElementPosition
- getElementRadius
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementSyncer
- getElementType
- getElementVelocity
- getElementZoneName
- getLowLODElement
- getRootElement
- hasElementData
- hasElementDataSubscriber
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementCollidableWith
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLocal
- isElementLowLOD
- isElementOnFire
- isElementOnScreen
- isElementStreamable
- isElementStreamedIn
- isElementSyncer
- isElementVisibleTo
- isElementWaitingForGroundToLoad
- isElementWithinColShape
- isElementWithinMarker
- removeElementData
- removeElementDataSubscriber
- setElementAlpha
- setElementAngularVelocity
- setElementAttachedOffsets
- setElementBonePosition
- setElementBoneQuaternion
- setElementBoneRotation
- setElementCallPropagationEnabled
- setElementCollidableWith
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementLighting
- setElementModel
- setElementOnFire
- setElementParent
- setElementPosition
- setElementRotation
- setElementStreamable
- setElementSyncer
- setElementVelocity
- setElementVisibleTo
- setLowLODElement
- updateElementRpHAnim
Element Events
- onClientElementColShapeHit
- onClientElementColShapeLeave
- onClientElementDataChange
- onClientElementDestroy
- onClientElementDimensionChange
- onClientElementInteriorChange
- onClientElementModelChange
- onClientElementStreamIn
- onClientElementStreamOut
- onElementClicked
- onElementColShapeHit
- onElementColShapeLeave
- onElementDataChange
- onElementDestroy
- onElementDimensionChange
- onElementInteriorChange
- onElementModelChange
- onElementStartSync
- onElementStopSync