GetMatrix

This function gets an entity's 4x4 matrix.

Syntax

Parameters

Example

--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()

local camera = Camera:Create()
camera:SetRotation(35,0,0)
camera:Move(0,0,-5)

local light = DirectionalLight:Create()
light:SetRotation(35,35,0)

--Create a model
entity = Model:Box()

while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end

Time:Update()
world:Update()
world:Render()

entity:Turn(Time:GetSpeed()*0.1,Time:GetSpeed()*0.2,Time:GetSpeed()*0.3)

--Display the matrix on screen
context:SetBlendMode(Blend.Alpha)
local mat = entity:GetMatrix()
context:DrawText("Row 0: "..mat[0]:ToString(),2,2)
context:DrawText("Row 1: "..mat[1]:ToString(),2,22)
context:DrawText("Row 2: "..mat[2]:ToString(),2,42)
context:DrawText("Row 3: "..mat[3]:ToString(),2,62)

context:Sync()
end