Skip to content

@vaguevoid/fiasco / math/coordinates / screenToView

Function: screenToView()

screenToView(screenPosition, screenDimensions, camera): Vec3

Defined in: src/math/coordinates.ts:124

Convert the given screen-space screenPosition using the screenDimensions into the local coordinate system of camera.

ts
import { Coords, Aspect, Camera, Query } from '@vaguevoid/fiasco'

function system(cameras: Query<[Camera]>, aspect: Aspect) {
  for (const [camera] of cameras) {
    const result = Coords.screenToView({ x: 0, y: 0 }, aspect.xy, camera)
  }
}

Parameters

screenPosition

Vec2

screenDimensions

Vec2

camera

Camera

Returns

Vec3