<!-- NEW6 — TEST 6 · THE FIVE SHORES · part 8 -->
 && z > b.minZ - BODY_R && z < b.maxZ + BODY_R) return b;
    }
    return null;
  }
  function inWater(x, z) {
    if (!meta.inWater) return false;
    return meta.inWater(x, z) && groundAt(x, z) < 2;
  }
  king.spawn = function (x, z, yaw) {
    king.x = x; king.z = z; king.yaw = yaw;
    group.position.set(x, groundAt(x, z), z);
    group.rotation.y = yaw;
    group.visible = true;
  };
  king.hide = function () { group.visible = false; };
  king.look = function (dYaw) { king.yaw += dYaw; };
  king.lift = function (dH) { king.boomH = Math.min(8, Math.max(2.2, king.boomH + dH)); };
  king.update = function (dt) {
    king.t += dt;
    const inp = king.input;
    if (inp.left) king.yaw += TURN_RATE * dt;
    if (inp.right) king.yaw -= TURN_RATE * dt;
    const fwd = (inp.fwd ? 1 : 0) - (inp.back ? 0.55 : 0);
    let moved = 0;
    if (fwd !== 0) {
      const dx = Math.sin(king.yaw) * fwd, dz = Math.cos(king.yaw) * fwd;
      const step = WALK_SPEED * dt;
      const nx = king.x + dx * step;
      if (!hitsCollider(nx, king.z) && !inWater(nx, king.z)) { king.x = nx; moved = step; }
      const nz = king.z + dz * step;
      if (!hitsCollider(king.x, nz) && !inWater(king.x, nz)) { king.z = nz; moved = step; }
      const rim = (meta.size || 2600) / 2 + 320;
      king.x = Math.max(-rim, Math.min(rim, king.x));
      king.z = Math.max(-rim, Math.min(rim, king.z));
    }
    group.position.set(king.x, groundAt(king.x, king.z), king.z);
    group.rotation.y = king.yaw;
    if (moved > 0) {
      king.phase += moved * gait.walk.phasePerUnit;
      poses.walk(rig, king.phase, 1);
    } else {
      poses.idle(rig, king.t, 0.8);
    }
    return { x: king.x, z: king.z, yaw: king.yaw };
  };
  const _want = new THREE.Vector3(), _look = new THREE.Vector3();
  king.boom = function (camera, dt) {
    const fx = Math.sin(king.yaw), fz = Math.cos(king.yaw);
    const gy = groundAt(king.x, king.z);
    _want.set(king.x - fx * king.boomD, gy + king.boomH, king.z - fz * king.boomD);
    const hit = hitsCollider(_want.x, _want.z);
    if (hit) _want.y = Math.max(_want.y, hit.top + 1.6);
    if (_want.y < king.BOOM_MIN_Y + gy) _want.y = king.BOOM_MIN_Y + gy;
    const k = 1 - Math.exp(-dt * 4.5);
    camera.position.lerp(_want, k);
    _look.set(king.x + fx * 5, gy + 1.7, king.z + fz * 5);
    camera.lookAt(_look);
    return camera.position;
  };
  return king;
}

export { makeKing };
export default makeKing;


===== FILE: public/new6/index.html =====
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>epistles — test 6</title>
<style>
  html, body { margin:0; padding:0; height:100%; background:#0b0e13; overflow:hidden; }
  #app { position:fixed; inset:0; }
  canvas { display:block; }
  #masthead {
    position:fixed; top:10px; left:12px; z-index:10; pointer-events:none;
    color:#e8e2d4; font-family: Georgia, 'Times New Roman', serif;
    text-shadow: 0 1px 8px rgba(0,0,0,.8);
  }
  #masthead .name { font-size:19px; letter-spacing:.14em; }
  #masthead .sub { font-size:12px; letter-spacing:.08em; opacity:.75; margin-top:2px; }
  #witness {
    position:fixed; left:12px; bottom:12px; z-index:10; max-width:min(430px, calc(100vw - 48px));
    color:#cfd6dd; background:rgba(10,13,18,.72); border:1px solid rgba(216,169,68,.35);
    border-radius:10px; padding:9px 12px; font:12px/1.55 ui-monospace, Menlo, monospace;
    white-space:pre-wrap; word-break:break-word; pointer-events:none;
  }
  #enterBtn {
    position:fixed; top:12px; right:12px; z-index:11;
    background:linear-gradient(180deg, #e9c766, #b98a2e); color:#241a05;
    border:1px solid #8a6a1f; border-radius:12px; padding:12px 16px;
    font:700 14px/1 Georgia, serif; letter-spacing:.06em; cursor:pointer;
    box-shadow: 0 4px 18px rgba(0,0,0,.5);
  }
  .pad {
    position:fixed; z-index:11; width:64px; height:64px; border-radius:50%;
    background:rgba(20,24,32,.55); border:1px solid rgba(232,226,212,.4);
    color:#e8e2d4; font-size:24px; display:none; align-items:center; justify-content:center;
    touch-action:none; user-select:none; -webkit-user-select:none;
  }
  .pad.on { background:rgba(216,169,68,.5); }
  body.inside .pad { display:flex; }
  #padFwd { right:26px; bottom:104px; } #padBack { right:26px; bottom:26px; }
  #padLeft { left:26px; bottom:26px; } #padRight { left:104px; bottom:26px; }
  @media (max-width:520px) { #witness { font-size:11px; } #masthead .name { font-size:16px; } }
</style>
<script>window.MAPFILE = 'mapdata6.js';</script>
<script type="importmap">
{ "imports": {
  "three": "./lib/three.module.js",
  "three/addons/": "./lib/addons/"
} }
</script>
</head>
<body>
<div id="app"></div>
<div id="masthead"><div class="name" id="mName">…</div><div class="sub" id="mSub"></div></div>
<div id="witness">raising the world…</div>
<button id="enterBtn">ENTER THE CITY</button>
