feat: App-Gerüst mit Spieler auf Testfläche
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a523dce676
commit
b27b9b7a61
10 files changed
+3630
No files matched your search
@@ -0,0 +1,27 @@
|
||||
export const TILE_PX = 256;
|
||||
export const WORLD_HALF = 16384; // gtadb-Weltgrenze in Metern
|
||||
export const CHUNK_SIZE = 250;
|
||||
export const SLICE = { x0: -1000, x1: 2000, y0: -500, y1: 2500 };
|
||||
export const CHUNKS_PER_SIDE = (SLICE.x1 - SLICE.x0) / CHUNK_SIZE; // 12
|
||||
|
||||
export const worldToThree = (X, Y) => ({ x: X, z: -Y });
|
||||
export const threeToWorld = (x, z) => ({ X: x, Y: -z });
|
||||
|
||||
export function tileForWorld(X, Y) {
|
||||
return {
|
||||
row: Math.floor((WORLD_HALF - Y) / TILE_PX),
|
||||
col: Math.floor((X + WORLD_HALF) / TILE_PX),
|
||||
};
|
||||
}
|
||||
|
||||
export function chunkForWorld(X, Y) {
|
||||
return {
|
||||
i: Math.floor((X - SLICE.x0) / CHUNK_SIZE),
|
||||
j: Math.floor((SLICE.y1 - Y) / CHUNK_SIZE),
|
||||
};
|
||||
}
|
||||
|
||||
/** Nordwest-Ecke eines Chunks in Weltkoordinaten. */
|
||||
export function chunkOrigin(i, j) {
|
||||
return { X: SLICE.x0 + i * CHUNK_SIZE, Y: SLICE.y1 - j * CHUNK_SIZE };
|
||||
}
|
||||
Reference in new issue
Block a user