1인칭: 요원 · 무기를 바꿔 다시 만들 때 눈 기준점을 팔 공간 좌표로 (이전 root 변환이 섞여 1.6m 밀리던 것) · 스파이크 설치 구간에 설치 동작(activate) 재생 (설치 시작 때 스파이크를 꺼내므로 꺼내기보다 먼저)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-29 18:35:24 +09:00
parent 1fb8821663
commit 309974087b
2 changed files with 11 additions and 3 deletions

View File

@@ -624,6 +624,9 @@ export default function ReplayViewer({ m, replay, sync }: Props) {
const a = samplePlayer(tr, t, replay.sampleMs * 6);
const b = samplePlayer(tr, t - 200, replay.sampleMs * 6);
const moving = !!a && !!b && Math.hypot(a.x - b.x, a.y - b.y) > 30;
// 스파이크 설치 중 (이어지는 동작 Plant 구간)
let activateMs: number | null = null;
for (const [a0, a1, k] of animIx.actions[p]) if (k === 'Plant' && a0 <= t && t <= a1) activateMs = t - a0;
return {
kind,
zoom,
@@ -634,6 +637,7 @@ export default function ReplayViewer({ m, replay, sync }: Props) {
reloadMs,
ads: zoom > 0,
walkMs: moving ? t : null,
activateMs: kind === 'Spike' ? activateMs : null,
},
};
};

View File

@@ -51,6 +51,8 @@ export interface VmInput {
ads: boolean;
/** 걷는 중이면 걸은 시간 (반복 동작 위치) */
walkMs: number | null;
/** 스파이크 설치 시작 뒤 (설치하는 동안만) */
activateMs?: number | null;
}
function findBone(root: THREE.Object3D, name: string): THREE.Object3D | null {
@@ -157,8 +159,9 @@ export class Viewmodel {
// 눈 = 팔 Camera 뼈 (대기 자세)
this.play(this.armsMixer, this.armClips.get('idle'), 0, false);
arms.updateMatrixWorld(true);
// 팔 공간 좌표로 (root 에 이전 요원 · 무기의 변환이 남아 있어도 같은 값)
const cam = findBone(arms, 'Camera');
const cp = cam ? new THREE.Vector3().setFromMatrixPosition(cam.matrixWorld) : new THREE.Vector3(0, 0, 166);
const cp = cam ? arms.worldToLocal(new THREE.Vector3().setFromMatrixPosition(cam.matrixWorld)) : new THREE.Vector3(0, 0, 166);
this.root.matrix.copy(UE_TO_VIEW).multiply(new THREE.Matrix4().makeTranslation(-cp.x, -cp.y, -cp.z));
this.root.matrixWorldNeedsUpdate = true;
}
@@ -181,14 +184,15 @@ export class Viewmodel {
return true;
}
/** 시각만으로 자세: 꺼내기 > 재장전 > 사격 > 걷기 > 정조준 > 대기 */
/** 시각만으로 자세: 스파이크 설치 > 꺼내기 > 재장전 > 사격 > 걷기 > 정조준 > 대기 (설치 시작 때 스파이크를 꺼내므로 설치가 먼저) */
pose(i: VmInput) {
if (!this.armsMixer || !this.gunMixer) return;
const dur = (n: string) => (this.armClips.get(n)?.duration ?? 0) * 1000;
let role = 'idle';
let ms = 0;
let loop = false;
if (i.equipMs != null && i.equipMs < dur('equip')) [role, ms] = ['equip', i.equipMs];
if (i.activateMs != null && this.armClips.has('activate')) [role, ms] = ['activate', i.activateMs];
else if (i.equipMs != null && i.equipMs < dur('equip')) [role, ms] = ['equip', i.equipMs];
else if (i.reloadMs != null && i.reloadMs < dur('reload')) [role, ms] = ['reload', i.reloadMs];
else if (i.shotMs != null && i.shotMs < dur('fire')) [role, ms] = ['fire', i.shotMs];
else if (i.walkMs != null && this.armClips.has('walk') && !i.ads) [role, ms, loop] = ['walk', i.walkMs, true];