WorldToScreen

Project a 3D world position to 2D screen space.

Syntax

Susano.WorldToScreen(x, y, z) -> boolean, number, number

Parameters

x (number): World X.

y (number): World Y.

z (number): World Z.

Return(s)

ok (boolean): true if the point projects in front of the camera, else false.

sx (number): Screen X in pixels.

sy (number): Screen Y in pixels.

Behavior

Returns ok=false when the point is behind the camera or projection invalid.

Does not clamp; sx, sy can be outside the visible bounds when off-screen.

Coordinates are suitable for Susano.Draw* functions.

Example(s)

local ok, sx, sy = Susano.WorldToScreen(250.0, -1040.0, 29.0)
if ok then
  Susano.DrawCircle(sx, sy, 4, true, 1, 0, 0, 1)
end

Last updated