@vaguevoid/fiasco / math/coordinates / worldToView
Function: worldToView()
worldToView(
position
,camera
):Vec3
Defined in: src/math/coordinates.ts:22
Convert the given world-space position
into the local coordinate system of the given camera
.
ts
import { Coords, Camera, Query } from '@vaguevoid/fiasco'
function system(cameras: Query<[Camera]>) {
for (const [camera] of cameras) {
const result = Coords.worldToView({ x: 0, y: 0, z: 0}, camera)
}
}
Parameters
position
A world space position as a Vec3.
camera
A camera, usually retrieved from a Query.
Returns
A Vec3 representing the position based on the camera.