Point

This function transforms a point from one space to another.

Syntax

Parameters

Returns

Returns the transformed point.

Example

--Create a window
window = Window:Create()

context = Context:Create(window)

world = World:Create()

local camera = Camera:Create()
camera:Move(0,0,-3)

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

--Create a model
model = Model:Box()
model:SetColor(0.0,0.0,1.0)
model:SetPosition(3,0,0)

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

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

--We're going to transform the position (2,0,0) from global space to the model's local space
--Because the model is positioned at (3,0,0) the point will be at (-1,0,0) in local space (relative to the model).
local position = Transform:Point(2,0,0,nil,model)
context:SetBlendMode(Blend.Alpha)
context:DrawText(position:ToString(),2,2)
context:SetBlendMode(Blend.Solid)
context:Sync()
end