Skip to main content
Version: 0.11.0

UeOrthographicCamera

The UeOrthographicCamera class creates a 3D camera with orthographic projection in Unique Engine.
In orthographic projection, objects appear the same size regardless of their distance from the camera, making it ideal for 2D games, technical drawings, or isometric views.

It inherits from UeCamera, meaning it includes all camera functionality plus scene graph features from UeObject3D.

Constructor​

new UeOrthographicCamera(data = {})

Data parameters​

KeyTypeDefaultDescription
leftnumber-view_wport[view] / 2Left plane of the camera frustum
rightnumberview_wport[view] / 2Right plane of the camera frustum
topnumberview_hport[view] / 2Top plane of the camera frustum
bottomnumber-view_hport[view] / 2Bottom plane of the camera frustum
nearnumber0.1Near clipping plane
farnumber2000Far clipping plane
zoomnumber1Zoom factor (scales the frustum)
viewnumber0Viewport to assign this camera to
x, y, znumber0, -100, 0Initial camera position
xt, yt, ztnumber0, 1, 0Look-at target coordinates
upX, upY, upZnumber0, 0, -1Camera up vector

Properties​

PropertyTypeDefaultDescription
isCamerabooleantrueIndicates that this is a camera
isOrthographicCamerabooleantrueIndicates that this is an orthographic camera
typestring"OrthographicCamera"Object type
leftnumber-width/2Left plane of the viewing frustum
rightnumberwidth/2Right plane of the viewing frustum
topnumberheight/2Top plane of the viewing frustum
bottomnumber-height/2Bottom plane of the viewing frustum
nearnumber0.1Near clipping plane distance
farnumber2000Far clipping plane distance
zoomnumber1Zoom factor that scales the frustum
cameraCameracamera_create()The underlying GameMaker camera object
targetUeVector3(0,1,0)The current look-at target position
matrixWorldUeMatrix4new UeMatrix4()World transformation matrix of the camera
matrixWorldInverseUeMatrix4new UeMatrix4()Inverse of matrixWorld, used in camera_set_view_mat()
projectionMatrixUeMatrix4new UeMatrix4()Projection matrix, used in camera_set_proj_mat()
projectionMatrixInverseUeMatrix4new UeMatrix4()Inverse of the projection matrix

Methods​

updateProjectionMatrix()​

updateProjectionMatrix()

Updates the camera's projection matrix using orthographic projection.
The zoom factor is applied to scale the frustum dimensions.

updateMatrixWorld()​

updateMatrixWorld()

Inherited from UeCamera. Updates the view matrix based on position, target, and up vector.

dispose()​

dispose()

Inherited from UeCamera. Cleans up the camera resource.

Notes​

  • The camera projection is built using matrix_build_projection_ortho()
  • Objects maintain the same size regardless of distance (parallel projection)
  • The frustum is automatically calculated from viewport dimensions if not specified
  • The zoom property scales the frustum: higher values = zoomed in, lower values = zoomed out
  • Perfect for 2D games, isometric views, or technical/architectural visualizations

Shadow Tips

  • When using an orthographic camera as a directional light shadow camera, manually adjust the camera frustum bounds (left, right, top, bottom) to tightly fit the scene or shadow-casting objects. This reduces wasted shadow map space and improves resolution.
  • Texel snapping aligns the orthographic projection to the shadow map texel grid and reduces shimmering during camera or light movement. The engine's UeDirectionalLightShadow implements snapping via updateMatrices().

Orthographic vs Perspective​

FeatureOrthographicPerspective
Projection typeParallelConverging to a point
Distance affects sizeNoYes (objects farther = smaller)
Depth perceptionFlat, no depth cuesRealistic depth
Typical use cases2D games, CAD, isometric views3D games, realistic rendering
Frustum shapeBox (rectangular prism)Truncated pyramid

Example​

Basic Usage​

const camera = new UeOrthographicCamera({
left: -400,
right: 400,
top: 300,
bottom: -300,
near: 0.1,
far: 1000,
x: 100, y: -300, z: 70,
xt: 0, yt: 0, zt: 0
});

Isometric View​

// Create an isometric camera
const camera = new UeOrthographicCamera({
zoom: 2, // Zoom in 2x
x: 100, y: -100, z: 100,
xt: 0, yt: 0, zt: 0
});

// Position creates 45-degree isometric angle
camera.setPosition(100, -100, 100);
camera.target.set(0, 0, 0);
camera.updateMatrixWorld();

Dynamic Zoom​

// Zoom in/out dynamically
camera.zoom = 1.5;
camera.updateProjectionMatrix();