Skip to main content

Function: screenToWorldSpace()

screenToWorldSpace(screenPosition, cameraPosition, cameraZoom, screenWidth, screenHeight): Vector2

Defined in: rendering/transforms/screen-to-world-space.ts:13

Converts a position from screen space to world space.

Parameters

screenPosition

Vector2

The position in screen space (e.g., mouse position relative to the viewport).

cameraPosition

Vector2

The position of the camera in world space.

cameraZoom

number

The zoom level of the camera.

screenWidth

number

The width of the screen in pixels.

screenHeight

number

The height of the screen in pixels.

Returns

Vector2

The position in world space.