Release Healer Man 0.1.18
This commit is contained in:
1 parent
fc8a7a722a
commit
eaddad4134
12 files changed
+107
-42
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { arenaCameraPose } from "./arenaCamera";
|
||||
import { ARENA_STAGES } from "./arenaStages";
|
||||
|
||||
describe("arena camera placement", () => {
|
||||
it("uses a finite overview anchor aimed at the playable center of every arena", () => {
|
||||
for (const stage of ARENA_STAGES) {
|
||||
for (const team of [0, 1] as const) {
|
||||
const { position, target } = arenaCameraPose(stage, team);
|
||||
expect(position).toEqual(stage.spectatorPositions[team]);
|
||||
expect(position[0], `${stage.id} team ${team} x`).toBeGreaterThan(stage.bounds.min[0]);
|
||||
expect(position[0], `${stage.id} team ${team} x`).toBeLessThan(stage.bounds.max[0]);
|
||||
expect(position[2], `${stage.id} team ${team} z`).toBeGreaterThan(stage.bounds.min[2]);
|
||||
expect(position[2], `${stage.id} team ${team} z`).toBeLessThan(stage.bounds.max[2]);
|
||||
expect(target.every(Number.isFinite)).toBe(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { ArenaStageManifest } from "./arenaTypes";
|
||||
|
||||
export interface ArenaCameraPose {
|
||||
readonly position: [number, number, number];
|
||||
readonly target: [number, number, number];
|
||||
}
|
||||
|
||||
export function arenaCameraPose(stage: ArenaStageManifest, team: 0 | 1): ArenaCameraPose {
|
||||
const centerX = (stage.bounds.min[0] + stage.bounds.max[0]) / 2;
|
||||
const centerZ = (stage.bounds.min[2] + stage.bounds.max[2]) / 2;
|
||||
const floorY = Math.min(...stage.teamSpawns.map((spawn) => spawn[1]));
|
||||
return {
|
||||
position: [...stage.spectatorPositions[team]],
|
||||
target: [centerX, floorY + 1.2, centerZ],
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user