setElementMatrix
Shared
Places and turns an element from a matrix.
bool setElementMatrix(element element, table matrix)
Parameters
| Name | Type | Description |
|---|---|---|
| element | element | The element. |
| matrix | table | A table of 4 rows of 4 numbers, like the one getElementMatrix returns: right, forward, up and position. The fourth column is ignored. |
Returns
true if it applied, false if the element has no position and rotation or the matrix gives values that are not finite.
Example
local vehicle = getPedOccupiedVehicle(localPlayer)
if vehicle then
local matrix = getElementMatrix(vehicle)
matrix[4][3] = matrix[4][3] + 2
setElementMatrix(vehicle, matrix)
endNoteA table without 4 rows of 4 finite numbers raises an error.