Files
bworld/client/camera.ts
T
2026-09-25 16:13:38 -03:00

26 lines
522 B
TypeScript

import type { Entity } from "./entity/entity.ts";
// where the world is drawn from. like minecraft's Camera it isn't an entity, it's moved to one's eyes every frame
export class Camera {
x = 0;
y = 0;
z = 3;
pitch = 0;
yaw = 0;
roll = 0;
fov = Math.PI / 3;
near = 0.1;
far = 1000;
setup(entity: Entity, partial_tick: number) {
const { x, y, z } = entity.render_position(partial_tick);
this.x = x;
this.y = y + entity.eye_height;
this.z = z;
this.yaw = entity.yaw;
this.pitch = entity.pitch;
}
}