<!-- RUBY-BACKUP · part 124 -->
rovoltaScales(body); }catch(e){}
      try{ enhanceRobotLook(body); }catch(e){}
      TABLE_BODIES.add(holder);
      scene.add(TABLE_BODIES);
      /* camera pulls back to see it all */
      try{
        if(typeof camera!=='undefined' && camera){
          var cdx = tx - camera.position.x;
          var cdz = tz - camera.position.z;
          var clen = Math.sqrt(cdx*cdx + cdz*cdz) || 1;
          cdx /= clen; cdz /= clen;
          camera.position.set(tx - cdx*12, 8, tz - cdz*12);
          camera.lookAt(tx, 1.5, tz);
        }
      }catch(e){}
      codeStatus('grand table — she rests, 6 times the room to work');
  });
}
/* TWO OF HER BODIES — laying face-up on the white table */
var TABLE_BODIES = null;
function layBodiesOnTable(){
  if(typeof scene==='undefined') return;
  if(typeof THREE==='undefined' || typeof THREE.GLTFLoader==='undefined'){
    codeStatus('GLTFLoader not ready');
    return;
  }
  /* clear old */
  if(TABLE_BODIES){
    try{ scene.remove(TABLE_BODIES); }catch(e){}
    TABLE_BODIES = null;
  }
  /* build the table IN FRONT of you */
  var tx = 0, tz = 0;
  try{
    if(typeof camera!=='undefined' && camera){
      var px = 0, pz = 0;
      if(typeof myAvatar!=='undefined' && myAvatar){ px = myAvatar.position.x; pz = myAvatar.position.z; }
      var dx, dz;
      if(typeof CROWN!=='undefined' && CROWN){
        /* crown mode: straight ahead of your eyes */
        var dir = new THREE.Vector3();
        camera.getWorldDirection(dir);
        dx = dir.x; dz = dir.z;
      } else {
        /* normal: beyond you, from the viewer's perspective */
        dx = px - camera.position.x;
        dz = pz - camera.position.z;
      }
      var len = Math.sqrt(dx*dx + dz*dz) || 1;
      dx /= len; dz /= len;
      var ox = (typeof CROWN!=='undefined' && CROWN) ? camera.position.x : px;
      var oz = (typeof CROWN!=='undefined' && CROWN) ? camera.position.z : pz;
      tx = ox + dx * 6;
      tz = oz + dz * 6;
    } else if(typeof myAvatar!=='undefined' && myAvatar){
      tx = myAvatar.position.x; tz = myAvatar.position.z + 5;
    }
  }catch(e){}
  buildIntricateTable(tx, tz);
  codeStatus('laying her down...');
  var loader = new THREE.GLTFLoader();
  loader.load('/ruby/warrior.glb?v=1',
    function(glb){
      TABLE_BODIES = new THREE.Group();
      /* tabletop surface is at y=1.21 */
      var tableY = 1.22;
      [-0.7, 0.7].forEach(function(offsetX, idx){
        var body = glb.scene.clone();
        var isReference = (idx === 0);
        body.traverse(function(o){ if(o.isMesh) o.userData.isReference = isReference; });
        /* scale to fit on table */
        var box = new THREE.Box3().setFromObject(body);
        var size = box.getSize(new THREE.Vector3());
        /* lay face-up: rotate -90 around X so front faces sky */
        var holder = new THREE.Group();
        /* center the body */
        var center = box.getCenter(new THREE.Vector3());
        body.position.set(-center.x, -center.y, -center.z);
        holder.add(body);
        /* rotate to lie on back, face up */
        holder.rotation.x = -Math.PI/2;
        /* scale down to fit table (table is 3.2 x 2.2) */
        var targetLen = 1.6;
        var s = targetLen / size.y;
        holder.scale.set(s, s, s);
        /* position on tabletop */
        /* after rotation, body length runs along Z, width along X */
        holder.position.set(tx + offsetX, tableY + 0.25*s + 0.05, tz);
        try{ applyProvoltaScales(body); }catch(e){}
        TABLE_BODIES.add(holder);
      });
      /* label them */
      try{
        [-0.7, 0.7].forEach(function(ox, li){
          var lcv = document.createElement('canvas');
          lcv.width = 256; lcv.height = 32;
          var lctx = lcv.getContext('2d');
          lctx.font = 'bold 20px Georgia'; lctx.textAlign = 'center';
          lctx.fillStyle = li===0 ? '#888888' : '#ffd700';
          lctx.fillText(li===0 ? 'REFERENCE — original' : 'EDITABLE — yours to shape', 128, 24);
          var ltex = new THREE.CanvasTexture(lcv);
          var llab = new THREE.Mesh(new THREE.PlaneGeometry(1.4, 0.17),
            new THREE.MeshBasicMaterial({map: ltex, transparent: true}));
          llab.position.set(tx + ox, tableY + 0.05, tz + 1.1);
          llab.rotation.x = -Math.PI/2;
          TABLE_BODIES.add(llab);
        });
      }catch(e){}
      scene.add(TABLE_BODIES);
      /* move camera to see the table */
      try{
        if(typeof camera!=='undefined' && camera){
          var dir = new THREE.Vector3();
          camera.getWorldDirection(dir);
          dir.y = 0; dir.normalize();
          /* position camera 4 units back from table, looking at it */
          camera.position.set(tx - dir.x*4, 3.5, tz - dir.z*4);
          camera.lookAt(tx, 1.2, tz);
        }
      }catch(e){}
      codeStatus('left: original reference — right: yours to shape');
    },
    undefined,
    function(err){ codeStatus('could not lay her down'); }
  );
}
function clearTabl