Function CommandBuilder2D.InScreenSpace

InScreenSpace (Camera camera)

Scope to draw multiple things in screen space of a camera.

Public
ScopeMatrix InScreenSpace (

Camera

camera

)

Scope to draw multiple things in screen space of a camera.

If you draw 2D coordinates (i.e. (x,y,0)) they will be projected onto a plane approximately [2*near clip plane of the camera] world units in front of the camera (but guaranteed to be between the near and far planes).

The lower left corner of the camera is (0,0,0) and the upper right is (camera.pixelWidth, camera.pixelHeight, 0)

Note

As a corollary, the centers of pixels are offset by 0.5. So for example the center of the top left pixel is at (0.5, 0.5, 0). Therefore, if you want to draw 1 pixel wide lines in screen space, you may want to offset the coordinates by 0.5 pixels.