Factory function to create Cute Voxel Rabbit in your world.

export function createAsset(THREE, options = {}) {
  const group = new THREE.Group();
  group.name = "Cute Voxel Rabbit";

  const bodyColor = options.bodyColor || "#f8f1df";
  const accentColor = options.accentColor || "#f6a6bd";
  const eyeColor = options.eyeColor || "#222222";
  const scale = options.scale === undefined ? 1 : options.scale;
  const showCarrot = options.showCarrot === undefined ? true : !!options.showCarrot;

  group.scale.setScalar(scale);

  const hopRoot = new THREE.Group();
  hopRoot.name = "whole rabbit hop body";
  hopRoot.userData.partId = "hop_root";
  group.add(hopRoot);

  const furMat = new THREE.MeshStandardMaterial({ color: new THREE.Color(bodyColor), roughness: 0.82, metalness: 0.02 });
  const accentMat = new THREE.MeshStandardMaterial({ color: new THREE.Color(accentColor), roughness: 0.78, metalness: 0.01 });
  const eyeMat = new THREE.MeshStandardMaterial({ color: new THREE.Color(eyeColor), roughness: 0.55, metalness: 0.02 });
  const carrotMat = new THREE.MeshStandardMaterial({ color: new THREE.Color("#f28c28"), roughness: 0.7, metalness: 0.02 });
  const leafMat = new THREE.MeshStandardMaterial({ color: new THREE.Color("#6fc36a"), roughness: 0.75, metalness: 0.02 });

  function box(name, partId, size, position, material) {
    const mesh = new THREE.Mesh(new THREE.BoxGeometry(size[0], size[1], size[2]), material);
    mesh.name = name;
    mesh.position.set(position[0], position[1], position[2]);
    mesh.userData.partId = partId;
    return mesh;
  }

  const body = box("rounded block body", "body", [1.2, 1.05, 0.9], [0, 0.75, 0], furMat);
  hopRoot.add(body);

  const belly = box("soft belly patch", "belly_patch", [0.68, 0.58, 0.06], [0, 0.72, 0.48], accentMat);
  hopRoot.add(belly);

  const head = box("large bunny head", "head", [0.95, 0.78, 0.82], [0, 1.48, 0.08], furMat);
  hopRoot.add(head);

  const leftEar = box("left tall ear", "left_ear", [0.28, 0.88, 0.24], [-0.3, 2.17, 0.04], furMat);
  leftEar.rotation.z = -0.12;
  hopRoot.add(leftEar);

  const rightEar = box("right tall ear", "right_ear", [0.28, 0.88, 0.24], [0.3, 2.17, 0.04], furMat);
  rightEar.rotation.z = 0.12;
  hopRoot.add(rightEar);

  const leftInnerEar = box("left pink inner ear", "left_inner_ear", [0.13, 0.55, 0.035], [-0.3, 2.17, 0.18], accentMat);
  leftInnerEar.rotation.z = -0.12;
  hopRoot.add(leftInnerEar);

  const rightInnerEar = box("right pink inner ear", "right_inner_ear", [0.13, 0.55, 0.035], [0.3, 2.17, 0.18], accentMat);
  rightInnerEar.rotation.z = 0.12;
  hopRoot.add(rightInnerEar);

  const leftEye = box("left shiny eye", "left_eye", [0.12, 0.12, 0.06], [-0.24, 1.56, 0.51], eyeMat);
  hopRoot.add(leftEye);

  const rightEye = box("right shiny eye", "right_eye", [0.12, 0.12, 0.06], [0.24, 1.56, 0.51], eyeMat);
  hopRoot.add(rightEye);

  const nose = box("tiny pink nose", "nose", [0.15, 0.1, 0.07], [0, 1.42, 0.54], accentMat);
  hopRoot.add(nose);

  const leftCheek = box("left cheek", "left_cheek", [0.16, 0.1, 0.04], [-0.31, 1.34, 0.52], accentMat);
  hopRoot.add(leftCheek);

  const rightCheek = box("right cheek", "right_cheek", [0.16, 0.1, 0.04], [0.31, 1.34, 0.52], accentMat);
  hopRoot.add(rightCheek);

  const leftFoot = box("left little foot", "left_foot", [0.42, 0.2, 0.52], [-0.34, 0.18, 0.18], furMat);
  hopRoot.add(leftFoot);

  const rightFoot = box("right little foot", "right_foot", [0.42, 0.2, 0.52], [0.34, 0.18, 0.18], furMat);
  hopRoot.add(rightFoot);

  const leftPaw = box("left front paw", "left_paw", [0.24, 0.38, 0.2], [-0.66, 0.86, 0.18], furMat);
  leftPaw.rotation.z = 0.18;
  hopRoot.add(leftPaw);

  const rightPaw = box("right front paw", "right_paw", [0.24, 0.38, 0.2], [0.66, 0.86, 0.18], furMat);
  rightPaw.rotation.z = -0.18;
  hopRoot.add(rightPaw);

  const tail = new THREE.Mesh(new THREE.BoxGeometry(0.36, 0.36, 0.36), furMat);
  tail.name = "square cotton tail";
  tail.position.set(0, 0.78, -0.52);
  tail.userData.partId = "tail";
  hopRoot.add(tail);

  if (showCarrot) {
    const carrot = new THREE.Group();
    carrot.name = "tiny carrot charm";
    carrot.userData.partId = "carrot_charm";
    carrot.position.set(0.82, 0.58, 0.32);
    carrot.rotation.z = -0.25;

    const carrotBody = box("carrot orange block", "carrot_body", [0.18, 0.42, 0.16], [0, 0, 0], carrotMat);
    carrot.add(carrotBody);

    const carrotLeafA = box("carrot leaf left", "carrot_leaf_left", [0.09, 0.2, 0.08], [-0.06, 0.3, 0], leafMat);
    carrotLeafA.rotation.z = 0.45;
    carrot.add(carrotLeafA);

    const carrotLeafB = box("carrot leaf right", "carrot_leaf_right", [0.09, 0.2, 0.08], [0.06, 0.3, 0], leafMat);
    carrotLeafB.rotation.z = -0.45;
    carrot.add(carrotLeafB);

    hopRoot.add(carrot);
  }

  return group;
}