M MY Multiplayer: Wiki
Side
Kind

getElementMatrix

Shared

Reads an element's 4x4 matrix, built from its position and rotation.

table|false getElementMatrix(element element [, bool legacy = true])

Parameters

NameTypeDescription
elementelementThe element to read.
legacyboolWith true, the fourth number of the first three rows is 1. With false, it is 0.default true

Returns

A table of four rows of four numbers: right, forward, up and position. false if the element has no position or rotation.

The fourth number of the position row is always 1.

Example

local m = getElementMatrix(localPlayer, false)
local x = m[4][1] + m[2][1] * 3
local y = m[4][2] + m[2][2] * 3
local z = m[4][3] + m[2][3] * 3
createObject("trafficcone", x, y, z)

See also