<!-- RUBY-BACKUP · part 315 -->
pcKings[nki].rotation.y += dt*0.25; }
  skyTick(dt);
  /* the look-target: origin, or the largest structure in center mode */
  var wantX = 0, wantZ = 0;
  if(renderMode==='center'){
    var LS = largestStone();
    if(LS){ wantX = LS.position.x; wantZ = LS.position.z; }
  }
  lookTarget.x += (wantX-lookTarget.x)*0.08;
  lookTarget.z += (wantZ-lookTarget.z)*0.08;
  /* the radiating disc follows the largest structure */
  if(renderMode==='radiate'){
    radiateDisc.visible = true;
    var RS = largestStone();
    radiateDisc.position.x = RS ? RS.position.x : 0;
    radiateDisc.position.z = RS ? RS.position.z : 0;
    radiateDisc.rotation.z = t*0.05;
  }else{
    radiateDisc.visible = false;
  }
  /* camera: a body when walking (from the view of Minimum), the high view otherwise */
  if(WALK){
    if(glide && !FLYM){
      _a1.set(glide.x-mePos.x, 0, glide.z-mePos.z);
      var _gd = _a1.length();
      if(_gd < 0.4 || Math.abs(joyX)>0.15 || Math.abs(joyY)>0.15) glide = null;
      else{
        _a1.normalize();
        mePos.addScaledVector(_a1, Math.min(_gd, 6*dt));
        faceYaw = Math.atan2(_a1.x, _a1.z);
      }
    }
    /* Walk mode — runs when not flying */
    if(typeof FLYM === 'undefined' || !FLYM){
      /* run: the joystick, camera-relative — in crown cam, eye-relative */
      if(CROWN) _a1.set(Math.sin(camYaw), 0, Math.cos(camYaw));
      else{
        _a1.set(mePos.x-camera.position.x, 0, mePos.z-camera.position.z);
        if(_a1.lengthSq()>0.0001) _a1.normalize();
      }
      _a2.set(-_a1.z, 0, _a1.x);
      /* Prone crawl — on belly: forward/back crawls like a soldier, left/right barely moves */
      var _crawlX = joyX, _crawlY = joyY;
      if(window._crawling){
        _crawlX = joyX * 0.6;  /* crawl mode: full tactical movement */
        _crawlY = joyY * 0.6;
      }else if(window._laying){
        _crawlX = joyX * 0.1;  /* lay: strafe barely moves, funny stuck */
        _crawlY = joyY * 0.35; /* lay: forward crawl only */
      }
      _a3.set(_a1.x*_crawlY+_a2.x*_crawlX, 0, _a1.z*_crawlY+_a2.z*_crawlX);
      var _fly = (typeof FLYM!=='undefined' && FLYM);
      var _spd = 93.6 * (_fly ? 25 : 1); /* walk 3x, fly 25x — King's order: faster */
      /* FLY VERTICAL — admin only, via Regime Change (not during sonic climb) */
      /* Dual-stick: View joystick (right) controls climb/dive, Body joystick (left) controls direction */
      /* PROVOLTA's body banks into the flight — she drives */
      if(_fly && myAvatar){
        try{
          var _bank = (window._flightStickX || 0) * 0.3 + joyX * 0.2;
          var _pitchB = (window._flightStickY || 0) * 0.3;
          myAvatar.rotation.z = -_bank;
          myAvatar.rotation.x = _pitchB * 0.5;
        }catch(e){}
      }
      /* GTA5 JET MODE — throttle, momentum, pitch and roll (King's order) */
      if(_fly && !window._sonicClimb){
        /* Throttle: left stick Y builds speed gradually */
        if(typeof window._jetThrottle === 'undefined') window._jetThrottle = 0;
        var _thr = -joyY; /* push up = throttle up */
        window._jetThrottle += _thr * dt * 0.8;
        window._jetThrottle = Math.max(0, Math.min(1.5, window._jetThrottle));
        /* Jet speed with momentum — doesn't stop on a dime */
        var _jetSpeed = 20 + window._jetThrottle * 200;
        /* Pitch: right stick Y pitches the nose */
        var _pitch = 0;
        if(window._flightStickY && Math.abs(window._flightStickY) > 0.1){
          _pitch = window._flightStickY * 0.8;
        }
        /* Roll: left stick X banks */
        var _roll = joyX * 0.6;
        if(window._flightStickX && Math.abs(window._flightStickX) > 0.1){
          _roll += window._flightStickX * 0.4;
        }
        /* Yaw: right stick X turns */
        if(window._flightStickX && Math.abs(window._flightStickX) > 0.1){
          if(typeof faceYaw !== 'undefined') faceYaw -= window._flightStickX * dt * 2;
        }
        /* Apply jet velocity in facing direction with pitch */
        if(typeof faceYaw !== 'undefined'){
          var _fx = Math.sin(faceYaw), _fz = Math.cos(faceYaw);
          var _fy = Math.sin(_pitch);
          var _fh = Math.cos(_pitch);
          meVel.x += (_fx * _fh * _jetSpeed - meVel.x) * Math.min(1, dt*2);
          meVel.z += (_fz * _fh * _jetSpeed - meVel.z) * Math.min(1, dt*2);
          meVel.y += (_fy * _jetSpeed - meVel.y) * Math.min(1, dt*2);
        }
        /* PROVOLTA banks and pitches like a jet */
        if(myAvatar){
          try{
            myAvatar.rotation.z = -_roll;
            myAvatar.rotation.x = _pitch * 0.5;
            if(typeof faceYaw !== 'undefined') myAvatar.rotation.y = faceYaw;
          }catch(e){}
        }
        onGround = false;
      }
      /* Takeoff lift — 2 seconds of strong climb when Fly is tapped */
      if(_fly && window._takeoffUntil && performance.now() < window._takeoffUntil){
        meVel.y += (40 - meVel.y) * Math.min(1, dt*5);
        onGround = false;
    