Skip to content

CameraViewAPI

Defined in: camera/Camera.ts:21

new CameraViewAPI(app_): CameraViewAPI

Defined in: camera/Camera.ts:24

App

CameraViewAPI

clipSegment(a, b): { a: Vec3; b: Vec3; } | null

Defined in: camera/Camera.ts:88

The part of segment

Vec3

Vec3

{ a: Vec3; b: Vec3; } | null

a →

b that can be drawn, cut at the near plane.

One end behind the eye still leaves a visible part, and dropping the whole segment is what makes a wireframe come apart as the eye moves into it. Null when none of it is in front.


getWorldBounds(): { bottom: number; left: number; right: number; top: number; } | null

Defined in: camera/Camera.ts:130

{ bottom: number; left: number; right: number; top: number; } | null


getWorldMousePosition(): { x: number; y: number; } | null

Defined in: camera/Camera.ts:124

{ x: number; y: number; } | null


projectDirectionAt(at, dir): { x: number; y: number; } | null

Defined in: camera/Camera.ts:114

Where a world DIRECTION points on screen at

Vec3

Vec3

{ x: number; y: number; } | null

at — px per world unit, y-up.

Null when

at has no projection. Perspective makes this a fact about the POINT: an arm drawn on something asks here, where a basis read off the camera answers only for the centre of the view.


screenRay(screenX, screenY): WorldRay | null

Defined in: camera/Camera.ts:54

The world ray a screen point names — what screenToWorld intersects with the z plane. Callers that drag along an arbitrary plane (an editor moving along a world axis, a pick against the ground) need the ray itself: a z-keyed answer cannot express a plane that is not z-keyed.

number

number

WorldRay | null


screenToWorld(screenX, screenY, planeZ?): { x: number; y: number; } | null

Defined in: camera/Camera.ts:40

Where a screen point lands on the world plane at

number

number

number = 0

{ x: number; y: number; } | null

planeZ.

A screen point is a ray. Orthographically its x/y do not vary along it, so the plane is irrelevant and the default answers for everyone. Under a perspective camera it decides the answer, and the right plane is the one the thing being hit or dragged actually sits on — z = 0 would place a sprite at z = -400 wherever its shadow on the 2D plane happens to fall.


worldToScreen(worldX, worldY, worldZ?): { x: number; y: number; } | null

Defined in: camera/Camera.ts:73

Where the world point lands on screen — the inverse of screenToWorld, taking the same third dimension. Under a perspective camera a point at

number

number

number = 0

{ x: number; y: number; } | null

worldZ projects nowhere near its shadow on the 2D plane, so anything drawing an overlay ON an entity (an outline, a gizmo, a screen rect) has to pass the entity’s z or it draws where the entity is not.

Null means the point has NO screen position: no camera, or it stands at or behind the eye, where the divide mirrors it to the far side of the view. Outside the viewport is NOT that, and keeps its coordinates.