Renderer · function
gizmoScaleFor
The world size that covers pixels screen pixels at the target's distance.
Explained in Hello world.
function gizmoScaleFor(camera: Camera, target: ArrayLike<number>, cssHeight: number, pixels: number): numberimport { gizmoScaleFor } from '@driftengine/core';Parameters
| Parameter | Type | Description |
|---|---|---|
camera | Camera | |
target | ArrayLike<number> | |
cssHeight | number | |
pixels | number |
In depth
A separate function rather than a method, which is what keeps every intersection and
every drag in this file testable against a bare ray: the gizmo never learns what a
camera is. A caller assigns the result to size once a frame.
Perspective only, because Camera is. An orthographic camera's answer does not depend
on distance at all, and the day one exists this grows a branch rather than a caller.