Skip to content

Commit e8a275a

Browse files
committed
Midnight Ops: knife takedown keeps the eye off the guard's head
- first person: start the takedown 0.65 m behind him (the body clip's 0.42 m put the eye in his helmet) - the eye, which rides the hero's lunging head bone, is held at least 0.55 m (level) from his head for the whole move Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 84c3b98 commit e8a275a

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

‎e63334287a3deaa3/ironveil/js/fp.js‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
// ---------------------------------------------------------------- camera
3030
const right = new THREE.Vector3(), tmp = new THREE.Vector3(), up = new THREE.Vector3(0, 1, 0), hv = new THREE.Vector3();
31+
const TD_EYE = 0.55; // m, closest the eye comes to a takedown victim's head
3132
FP.frame = function (cam, dt, dir, yaw, pitch) {
3233
const S = IV.settings, W8 = IV.weapons, pr = P.render;
3334
// eye height by stance, eased (a slight overshoot coming up)
@@ -100,7 +101,16 @@
100101
if (cl > 1e-3) { const h = W.raycast(pr.x + f.x * 0.08, ey, pr.z + f.z * 0.08, cx / cl, 0, cz / cl, cl + 0.15, F.SOLID | F.SIGHT, true); if (h) { const k = Math.max(0, h.t - 0.15) / cl; cx *= k; cz *= k; } }
101102
cx *= FP.crK * (1 - bk); cz *= FP.crK * (1 - bk);
102103
}
103-
const exo = f.x * 0.08 * (1 - bk) + (FP.hx || 0) * bk + cx, ezo = f.z * 0.08 * (1 - bk) + (FP.hz || 0) * bk + cz, eyo = (ey - pr.y) * (1 - bk) + (FP.hy != null ? FP.hy : ey - pr.y) * bk;
104+
let exo = f.x * 0.08 * (1 - bk) + (FP.hx || 0) * bk + cx, ezo = f.z * 0.08 * (1 - bk) + (FP.hz || 0) * bk + cz; const eyo = (ey - pr.y) * (1 - bk) + (FP.hy != null ? FP.hy : ey - pr.y) * bk;
105+
// knife takedown: the hero's clip lunges the head forward into the guard, and the eye rides that head bone, so the
106+
// eye ended up inside his helmet. Keep the eye at least TD_EYE m (level) from the guard's head the whole move, so the
107+
// knife hand and the guard stay in view in front of you.
108+
const vic = W8.takedownVictim;
109+
if (vic && P.cineClip && vic.actor) {
110+
const vb = vic.actor.bone && vic.actor.bone('Head'); if (vb) vb.getWorldPosition(tmp); else tmp.set(vic.pos.x, vic.pos.y + 1.6, vic.pos.z);
111+
const dx = pr.x + exo - tmp.x, dz = pr.z + ezo - tmp.z, d = Math.hypot(dx, dz);
112+
if (d < TD_EYE) { const k = d > 1e-3 ? (TD_EYE - d) / d : 0; if (k) { exo += dx * k; ezo += dz * k; } else { exo -= fb.x * TD_EYE; ezo -= fb.z * TD_EYE; } }
113+
}
104114
cam.position.set(pr.x + right.x * (FP.lean * 0.3 + bx) + exo, pr.y + eyo + by + (C.bobY || 0) - Math.abs(FP.lean) * 0.04, pr.z + right.z * (FP.lean * 0.3 + bx) + ezo);
105115
// never into the ground: the drawn ground's flat triangles sit above the true height in dips (up to ~0.3 m), so
106116
// prone, with the eye about 0.3 m up, the near plane could cut into it and show the underside. Keep the eye 15 cm

‎e63334287a3deaa3/ironveil/js/weapons.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,10 @@
479479
WP.stats.takedowns++; WP.stats.kills++;
480480
P.frozen = true; WP.aiming = WP.scoped = false;
481481
const f = IV.fwd(e.bodyYaw);
482-
const gap = IVChars.takedownGap || (IVChars.standin ? 0.75 : 0.42); // chars.js clips want 0.42 m
482+
// chars.js clips want 0.42 m; in first person the body is not seen, so start a little further back (the eye is also
483+
// kept off his head in js/fp.js) and the knife hand and the guard stay in view
484+
const gap = Math.max(IVChars.takedownGap || (IVChars.standin ? 0.75 : 0.42), IV.camera && IV.camera.mode === 'first' ? 0.65 : 0);
485+
WP.takedownVictim = e;
483486
const tx = e.pos.x - f.x * gap, tz = e.pos.z - f.z * gap;
484487
const sx = P.pos.x, sz = P.pos.z; let t = 0;
485488
P.bodyYaw = e.bodyYaw; P.yaw = e.bodyYaw;

0 commit comments

Comments
 (0)