자동 시점 · 점수판 보완: 궁극기 점수는 공수 교대(선수 시작 자리가 40m 넘게 옮겨 간 라운드) 초기화를 사용으로 보지 않음 (한 명만 점수가 있어도) · 전략 보기 카메라 거리를 시야각 · 화면비 · 기울기로 계산해 모든 선수가 화면 안 (fitDistance) · 라운드가 끝난 뒤 점수판 팀 점수는 그 라운드까지 (최종 점수) · 테스트
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ import CrosshairPanel from './CrosshairPanel';
|
||||
import { buildAnimIndex, rigInput } from '../lib/replayAnim';
|
||||
import { abilityLook, type AbilityLook } from '../lib/abilities';
|
||||
import { loadVfxDb, vfxCoverage, VfxObject, type Place, type VfxDb } from '../lib/vfx';
|
||||
import { buildDirector, shotIndexAt, SHOT_LABEL } from '../lib/director';
|
||||
import { buildDirector, fitDistance, shotIndexAt, SHOT_LABEL } from '../lib/director';
|
||||
import { boardIndex } from '../lib/scoreboard';
|
||||
import ReplayScoreboard from './ReplayScoreboard';
|
||||
|
||||
@@ -50,6 +50,11 @@ type View = Exclude<CamMode, 'auto'>;
|
||||
const CAM_LABEL: Record<CamMode, string> = { auto: '자동', top: '위에서', fp: '1인칭', free: '자유시점' };
|
||||
/** 자동 · 위에서 볼 때 카메라가 따라가는 빠르기 (1초에 남은 거리의 이만큼) */
|
||||
const AUTO_EASE = 2.2;
|
||||
/** 자동 · 위에서: 보는 곳에서 카메라 쪽 방향 (위로 많이 · 앞으로 조금, 단위 벡터) */
|
||||
const AUTO_DIR: [number, number, number] = (() => {
|
||||
const l = Math.hypot(0.92, 0.42);
|
||||
return [0, 0.92 / l, 0.42 / l];
|
||||
})();
|
||||
|
||||
type MapState = { state: 'none' | 'loading' | 'ready' | 'error'; progress?: number };
|
||||
/** 천장 자르기: 자동 · 끔 · 직접(가장 낮은 층에서 cm) */
|
||||
@@ -1044,6 +1049,7 @@ export default function ReplayViewer({ m, replay, sync }: Props) {
|
||||
} else if (auto) {
|
||||
// 전략 보기: 살아 있는 선수(없으면 모두)가 다 들어오게 내려다본다
|
||||
let n = 0;
|
||||
let aliveN = 0;
|
||||
let x0 = Infinity, x1 = -Infinity, z0 = Infinity, z1 = -Infinity, ySum = 0;
|
||||
for (const pass of [0, 1]) {
|
||||
for (const v of views) {
|
||||
@@ -1053,15 +1059,23 @@ export default function ReplayViewer({ m, replay, sync }: Props) {
|
||||
ySum += q.y;
|
||||
n++;
|
||||
}
|
||||
if (pass === 0) aliveN = n;
|
||||
if (n) break;
|
||||
}
|
||||
if (n) {
|
||||
autoGoal.set((x0 + x1) / 2, ySum / n, (z0 + z1) / 2);
|
||||
autoDist = Math.max(36, Math.min(125, Math.max(x1 - x0, (z1 - z0) * camera.aspect * 0.8) * 0.95 + 26));
|
||||
// 시야각 · 화면비 · 기울기로 모두가 들어오는 거리 (선수 몸 · 이름표 높이만큼 위아래로 넉넉히)
|
||||
const pts: [number, number, number][] = [];
|
||||
for (const v of views) {
|
||||
if (!v.group.visible || (aliveN > 0 && isDead(replay, v.idx, t))) continue;
|
||||
const q = v.group.position;
|
||||
pts.push([q.x, q.y, q.z], [q.x, q.y + 6, q.z]);
|
||||
}
|
||||
autoDist = Math.max(36, Math.min(400, fitDistance(pts, [autoGoal.x, autoGoal.y, autoGoal.z], AUTO_DIR, camera.fov, camera.aspect)));
|
||||
}
|
||||
const k = 1 - Math.exp(-dt * AUTO_EASE);
|
||||
autoTarget.lerp(autoGoal, k);
|
||||
tmp.set(autoTarget.x, autoTarget.y + autoDist * 0.92, autoTarget.z + autoDist * 0.42);
|
||||
tmp.set(autoTarget.x + AUTO_DIR[0] * autoDist, autoTarget.y + AUTO_DIR[1] * autoDist, autoTarget.z + AUTO_DIR[2] * autoDist);
|
||||
camera.position.lerp(tmp, k);
|
||||
camera.lookAt(autoTarget);
|
||||
} else controls.update();
|
||||
|
||||
Reference in New Issue
Block a user