Skip to content

Vibe coding a plugin? 😎 Teach your agent Modlumi first. Works with Claude Code, Codex, Cursor and more.

Viewport

The viewport of the desktop window, from PluginContext.viewport. Positions are in model coordinates, and screen positions in logical pixels from the viewport’s top left.

readonly camera: Camera

The camera the viewport shows the model with, as of now.


readonly height: number


readonly width: number

Logical pixels; 0 while the window has no size.

project(point): readonly [number, number] | null

Where a point shows in the viewport, as [x, y], or null when it is behind the camera.

Point3dLike

readonly [number, number] | null


ray(x, y): { direction: Vector3d; origin: Point3d; } | null

The ray from the camera through a viewport position, or null while the viewport has no size.

number

number

{ direction: Vector3d; origin: Point3d; } | null


setCamera(camera, options?): void

Moves the camera, gliding over duration seconds when given. The move starts after the plugin’s code for this frame, so camera returns the camera as shown until then, and PluginContext.onCameraChanged listeners hear each step. The user’s own navigation stops a glide, as do the plugin stopping and another model opening.

Camera

CameraMoveOptions

void

// Looks at the origin from the front, in a parallel projection, over half a second.
const front = new modlumi.Camera([0, -20, 1.5], [0, 0, 1.5], { perspective: false });
context.viewport.setCamera(front, { duration: 0.5 });