diff --git a/packages/web/src/LiveFirstPerson.svelte b/packages/web/src/LiveFirstPerson.svelte index 1721360..35b82e8 100644 --- a/packages/web/src/LiveFirstPerson.svelte +++ b/packages/web/src/LiveFirstPerson.svelte @@ -349,11 +349,17 @@ } else if (aim && !aim.self) { const ax = aim.x + 0.5, ay = aim.y + 0.5; const wantFacing = Math.atan2(ay - ty, ax - tx); - // Your own magic turns your head — but never wrenches it: a deed - // you aimed BEHIND you via the keymap stays behind you. Things - // done TO you may still spin the world. - if (actor === povId && Math.abs(shortestArc(camF, wantFacing)) > Math.PI * 0.55) { - // deliberately unaimed + const arc = Math.abs(shortestArc(camF, wantFacing)); + if (actor === povId) { + // Your own magic turns your head — but never wrenches it and + // NEVER cuts away: casting a door onto the wall you face must + // not fling the eyes to some other vantage. A gentle turn when + // the deed is off to the side; nothing when it is behind you + // or already in frame. + if (arc <= Math.PI * 0.55) { + targetFacing = wantFacing; + aimed = true; + } } else { const toAim = Math.hypot(ax - tx, ay - ty); const sight = castRay(v, tx, ty, wantFacing);