Codels
2596 三角面2.73 × 3.74 × 3.68 m

在代码中使用

在编辑器中改编
自包含的 ES 模块,仅依赖 three。调用工厂函数,然后把返回的 group 添加到场景中。
/**
 * Log Raft — Codels 3D model library
 * License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
 * Triangles: 2,596 · Size (W × H × D): 2.73 × 3.74 × 3.68 m
 *
 * Usage:
 *   import { createRaft } from './raft.js';
 *   
 *   const model = createRaft();
 *   model.position.set(0, 0, 0);
 *   scene.add(model);
 */
import * as THREE from 'three';

const deg = THREE.MathUtils.degToRad;

// Deterministic vertex displacement (organic low-poly look).
function jitter(geometry, amount, seed) {
  const pos = geometry.attributes.position;
  const h = (a, b, c, s) => {
    let x = Math.imul(a, 73856093) ^ Math.imul(b, 19349663) ^ Math.imul(c, 83492791) ^ Math.imul(s, 2654435761);
    x = Math.imul(x ^ (x >>> 16), 2246822507);
    x = Math.imul(x ^ (x >>> 13), 3266489909);
    return ((x ^ (x >>> 16)) >>> 0) / 4294967295 - 0.5;
  };
  for (let i = 0; i < pos.count; i++) {
    const x = pos.getX(i), y = pos.getY(i), z = pos.getZ(i);
    const qx = Math.round(x * 1000), qy = Math.round(y * 1000), qz = Math.round(z * 1000);
    pos.setXYZ(i, x + h(qx, qy, qz, seed) * 2 * amount, y + h(qx, qy, qz, seed + 1) * 2 * amount, z + h(qx, qy, qz, seed + 2) * 2 * amount);
  }
  pos.needsUpdate = true;
  geometry.computeVertexNormals();
  return geometry;
}

// Revolve a 2D profile [[radius, y], ...] around the Y axis.
function lathe(points, segments, phiStart = 0, phiLength = Math.PI * 2) {
  return new THREE.LatheGeometry(points.map(([x, y]) => new THREE.Vector2(x, y)), segments, phiStart, phiLength);
}

// Tube along a smooth curve through the given points.
function tube(path, radius, tubularSegments, radialSegments, closed = false) {
  const curve = new THREE.CatmullRomCurve3(path.map(([x, y, z]) => new THREE.Vector3(x, y, z)), closed);
  return new THREE.TubeGeometry(curve, tubularSegments, radius, radialSegments, closed);
}

export function createRaft() {
  const root = new THREE.Group();
  root.name = 'Raft';

  // Materials
  const barkMat = new THREE.MeshStandardMaterial({ name: 'bark', color: 0x7a5636, roughness: 0.95, flatShading: true });
  const cutMat = new THREE.MeshStandardMaterial({ name: 'cut', color: 0xd4ac70, roughness: 0.9, flatShading: true });
  const ropeMat = new THREE.MeshStandardMaterial({ name: 'rope', color: 0xcdb27c, roughness: 0.95, flatShading: true });
  const sailMat = new THREE.MeshStandardMaterial({ name: 'sail', color: 0xe8dcbc, roughness: 0.9, flatShading: true, side: THREE.DoubleSide });
  const clothMat = new THREE.MeshStandardMaterial({ name: 'cloth', color: 0xb39a6c, roughness: 0.95, flatShading: true, side: THREE.DoubleSide });
  const crateMat = new THREE.MeshStandardMaterial({ name: 'crate', color: 0xb4844f, roughness: 0.85, flatShading: true });
  const darkMat = new THREE.MeshStandardMaterial({ name: 'dark', color: 0x3a3430, roughness: 0.6, metalness: 0.4, flatShading: true });
  const glowMat = new THREE.MeshStandardMaterial({ name: 'glow', color: 0xffd77a, roughness: 0.5, emissive: 0xffb43c, emissiveIntensity: 1.4, flatShading: true });

  // Shared geometries
  const cylinderGeo = new THREE.CylinderGeometry(0.147, 0.147, 0.03, 7);
  const cylinderGeo2 = new THREE.CylinderGeometry(0.1385, 0.1385, 0.03, 7);
  const cylinderGeo3 = new THREE.CylinderGeometry(0.1382, 0.1382, 0.03, 7);
  const cylinderGeo4 = new THREE.CylinderGeometry(0.1374, 0.1374, 0.03, 7);
  const cylinderGeo5 = new THREE.CylinderGeometry(0.1346, 0.1346, 0.03, 7);
  const cylinderGeo6 = new THREE.CylinderGeometry(0.1432, 0.1432, 0.03, 7);
  const cylinderGeo7 = new THREE.CylinderGeometry(0.1372, 0.1372, 0.03, 7);
  const cylinderGeo8 = new THREE.CylinderGeometry(0.1, 0.1, 2.68, 7);
  const cylinderGeo9 = new THREE.CylinderGeometry(0.085, 0.085, 0.03, 7);
  const torusGeo = new THREE.TorusGeometry(0.12, 0.022, 4, 8);
  const boxGeo = new THREE.BoxGeometry(1.1, 0.04, 0.24);
  const torusGeo2 = new THREE.TorusGeometry(0.265, 0.018, 3, 10);

  // Parts
  const raft = new THREE.Group();
  raft.name = 'raft';
  raft.position.set(0, 0.0058, 0);
  root.add(raft);
  const logs = new THREE.Group();
  logs.name = 'logs';
  raft.add(logs);
  const log1 = new THREE.Mesh(jitter(new THREE.CylinderGeometry(0.1709, 0.1709, 3.4445, 7), 0.012, 3), barkMat);
  log1.name = 'log1';
  log1.position.set(-1.02, 0.17, -0.0103);
  log1.rotation.set(deg(90), deg(8.4867), 0);
  logs.add(log1);
  const logEnd = new THREE.Mesh(cylinderGeo, cutMat);
  logEnd.name = 'logEnd';
  logEnd.position.set(-1.02, 0.17, 1.7169);
  logEnd.rotation.set(deg(90), 0, 0);
  logs.add(logEnd);
  const logEnd2 = new THREE.Mesh(cylinderGeo, cutMat);
  logEnd2.name = 'logEnd';
  logEnd2.position.set(-1.02, 0.17, -1.7376);
  logEnd2.rotation.set(deg(90), 0, 0);
  logs.add(logEnd2);
  const log2 = new THREE.Mesh(jitter(new THREE.CylinderGeometry(0.161, 0.161, 3.2569, 7), 0.012, 4), barkMat);
  log2.name = 'log2';
  log2.position.set(-0.68, 0.17, 0.0053);
  log2.rotation.set(deg(90), deg(6.2372), 0);
  logs.add(log2);
  const logEnd3 = new THREE.Mesh(cylinderGeo2, cutMat);
  logEnd3.name = 'logEnd';
  logEnd3.position.set(-0.68, 0.17, 1.6388);
  logEnd3.rotation.set(deg(90), 0, 0);
  logs.add(logEnd3);
  const logEnd4 = new THREE.Mesh(cylinderGeo2, cutMat);
  logEnd4.name = 'logEnd';
  logEnd4.position.set(-0.68, 0.17, -1.6281);
  logEnd4.rotation.set(deg(90), 0, 0);
  logs.add(logEnd4);
  const log3 = new THREE.Mesh(jitter(new THREE.CylinderGeometry(0.1606, 0.1606, 3.5608, 7), 0.012, 5), barkMat);
  log3.name = 'log3';
  log3.position.set(-0.34, 0.17, -0.0055);
  log3.rotation.set(deg(90), deg(19.1029), 0);
  logs.add(log3);
  const logEnd5 = new THREE.Mesh(cylinderGeo3, cutMat);
  logEnd5.name = 'logEnd';
  logEnd5.position.set(-0.34, 0.17, 1.7799);
  logEnd5.rotation.set(deg(90), 0, 0);
  logs.add(logEnd5);
  const logEnd6 = new THREE.Mesh(cylinderGeo3, cutMat);
  logEnd6.name = 'logEnd';
  logEnd6.position.set(-0.34, 0.17, -1.7909);
  logEnd6.rotation.set(deg(90), 0, 0);
  logs.add(logEnd6);
  const log4 = new THREE.Mesh(jitter(new THREE.CylinderGeometry(0.1598, 0.1598, 3.5081, 7), 0.012, 6), barkMat);
  log4.name = 'log4';
  log4.position.set(0, 0.17, -0.0386);
  log4.rotation.set(deg(90), deg(0.0365), 0);
  logs.add(log4);
  const logEnd7 = new THREE.Mesh(cylinderGeo4, cutMat);
  logEnd7.name = 'logEnd';
  logEnd7.position.set(0, 0.17, 1.7205);
  logEnd7.rotation.set(deg(90), 0, 0);
  logs.add(logEnd7);
  const logEnd8 = new THREE.Mesh(cylinderGeo4, cutMat);
  logEnd8.name = 'logEnd';
  logEnd8.position.set(0, 0.17, -1.7977);
  logEnd8.rotation.set(deg(90), 0, 0);
  logs.add(logEnd8);
  const log5 = new THREE.Mesh(jitter(new THREE.CylinderGeometry(0.1565, 0.1565, 3.4821, 7), 0.012, 7), barkMat);
  log5.name = 'log5';
  log5.position.set(0.34, 0.17, 0.0221);
  log5.rotation.set(deg(90), deg(-1.4609), 0);
  logs.add(log5);
  const logEnd9 = new THREE.Mesh(cylinderGeo5, cutMat);
  logEnd9.name = 'logEnd';
  logEnd9.position.set(0.34, 0.17, 1.7682);
  logEnd9.rotation.set(deg(90), 0, 0);
  logs.add(logEnd9);
  const logEnd10 = new THREE.Mesh(cylinderGeo5, cutMat);
  logEnd10.name = 'logEnd';
  logEnd10.position.set(0.34, 0.17, -1.7239);
  logEnd10.rotation.set(deg(90), 0, 0);
  logs.add(logEnd10);
  const log6 = new THREE.Mesh(jitter(new THREE.CylinderGeometry(0.1665, 0.1665, 3.5484, 7), 0.012, 8), barkMat);
  log6.name = 'log6';
  log6.position.set(0.68, 0.17, -0.0898);
  log6.rotation.set(deg(90), deg(-23.4231), 0);
  logs.add(log6);
  const logEnd11 = new THREE.Mesh(cylinderGeo6, cutMat);
  logEnd11.name = 'logEnd';
  logEnd11.position.set(0.68, 0.17, 1.6895);
  logEnd11.rotation.set(deg(90), 0, 0);
  logs.add(logEnd11);
  const logEnd12 = new THREE.Mesh(cylinderGeo6, cutMat);
  logEnd12.name = 'logEnd';
  logEnd12.position.set(0.68, 0.17, -1.869);
  logEnd12.rotation.set(deg(90), 0, 0);
  logs.add(logEnd12);
  const log7 = new THREE.Mesh(jitter(new THREE.CylinderGeometry(0.1596, 0.1596, 3.2975, 7), 0.012, 9), barkMat);
  log7.name = 'log7';
  log7.position.set(1.02, 0.17, -0.0876);
  log7.rotation.set(deg(90), deg(14.1774), 0);
  logs.add(log7);
  const logEnd13 = new THREE.Mesh(cylinderGeo7, cutMat);
  logEnd13.name = 'logEnd';
  logEnd13.position.set(1.02, 0.17, 1.5661);
  logEnd13.rotation.set(deg(90), 0, 0);
  logs.add(logEnd13);
  const logEnd14 = new THREE.Mesh(cylinderGeo7, cutMat);
  logEnd14.name = 'logEnd';
  logEnd14.position.set(1.02, 0.17, -1.7414);
  logEnd14.rotation.set(deg(90), 0, 0);
  logs.add(logEnd14);
  const beams = new THREE.Group();
  beams.name = 'beams';
  raft.add(beams);
  const crossBeam = new THREE.Mesh(cylinderGeo8, barkMat);
  crossBeam.name = 'crossBeam';
  crossBeam.position.set(0, 0.41, -1.15);
  crossBeam.rotation.set(0, 0, deg(90));
  beams.add(crossBeam);
  const cylinder26 = new THREE.Mesh(cylinderGeo9, cutMat);
  cylinder26.position.set(1.35, 0.41, -1.15);
  cylinder26.rotation.set(0, 0, deg(90));
  beams.add(cylinder26);
  const cylinder27 = new THREE.Mesh(cylinderGeo9, cutMat);
  cylinder27.position.set(-1.35, 0.41, -1.15);
  cylinder27.rotation.set(0, 0, deg(90));
  beams.add(cylinder27);
  const lashing = new THREE.Mesh(torusGeo, ropeMat);
  lashing.name = 'lashing';
  lashing.position.set(-0.918, 0.38, -1.15);
  lashing.rotation.set(0, deg(90), 0);
  beams.add(lashing);
  const lashing2 = new THREE.Mesh(torusGeo, ropeMat);
  lashing2.name = 'lashing';
  lashing2.position.set(-0.578, 0.38, -1.15);
  lashing2.rotation.set(0, deg(90), 0);
  beams.add(lashing2);
  const lashing3 = new THREE.Mesh(torusGeo, ropeMat);
  lashing3.name = 'lashing';
  lashing3.position.set(-0.238, 0.38, -1.15);
  lashing3.rotation.set(0, deg(90), 0);
  beams.add(lashing3);
  const lashing4 = new THREE.Mesh(torusGeo, ropeMat);
  lashing4.name = 'lashing';
  lashing4.position.set(0.102, 0.38, -1.15);
  lashing4.rotation.set(0, deg(90), 0);
  beams.add(lashing4);
  const lashing5 = new THREE.Mesh(torusGeo, ropeMat);
  lashing5.name = 'lashing';
  lashing5.position.set(0.442, 0.38, -1.15);
  lashing5.rotation.set(0, deg(90), 0);
  beams.add(lashing5);
  const lashing6 = new THREE.Mesh(torusGeo, ropeMat);
  lashing6.name = 'lashing';
  lashing6.position.set(0.782, 0.38, -1.15);
  lashing6.rotation.set(0, deg(90), 0);
  beams.add(lashing6);
  const lashing7 = new THREE.Mesh(torusGeo, ropeMat);
  lashing7.name = 'lashing';
  lashing7.position.set(1.122, 0.38, -1.15);
  lashing7.rotation.set(0, deg(90), 0);
  beams.add(lashing7);
  const crossBeam2 = new THREE.Mesh(cylinderGeo8, barkMat);
  crossBeam2.name = 'crossBeam';
  crossBeam2.position.set(0, 0.41, 1.15);
  crossBeam2.rotation.set(0, 0, deg(90));
  beams.add(crossBeam2);
  const cylinder36 = new THREE.Mesh(cylinderGeo9, cutMat);
  cylinder36.position.set(1.35, 0.41, 1.15);
  cylinder36.rotation.set(0, 0, deg(90));
  beams.add(cylinder36);
  const cylinder37 = new THREE.Mesh(cylinderGeo9, cutMat);
  cylinder37.position.set(-1.35, 0.41, 1.15);
  cylinder37.rotation.set(0, 0, deg(90));
  beams.add(cylinder37);
  const lashing8 = new THREE.Mesh(torusGeo, ropeMat);
  lashing8.name = 'lashing';
  lashing8.position.set(-0.918, 0.38, 1.15);
  lashing8.rotation.set(0, deg(90), 0);
  beams.add(lashing8);
  const lashing9 = new THREE.Mesh(torusGeo, ropeMat);
  lashing9.name = 'lashing';
  lashing9.position.set(-0.578, 0.38, 1.15);
  lashing9.rotation.set(0, deg(90), 0);
  beams.add(lashing9);
  const lashing10 = new THREE.Mesh(torusGeo, ropeMat);
  lashing10.name = 'lashing';
  lashing10.position.set(-0.238, 0.38, 1.15);
  lashing10.rotation.set(0, deg(90), 0);
  beams.add(lashing10);
  const lashing11 = new THREE.Mesh(torusGeo, ropeMat);
  lashing11.name = 'lashing';
  lashing11.position.set(0.102, 0.38, 1.15);
  lashing11.rotation.set(0, deg(90), 0);
  beams.add(lashing11);
  const lashing12 = new THREE.Mesh(torusGeo, ropeMat);
  lashing12.name = 'lashing';
  lashing12.position.set(0.442, 0.38, 1.15);
  lashing12.rotation.set(0, deg(90), 0);
  beams.add(lashing12);
  const lashing13 = new THREE.Mesh(torusGeo, ropeMat);
  lashing13.name = 'lashing';
  lashing13.position.set(0.782, 0.38, 1.15);
  lashing13.rotation.set(0, deg(90), 0);
  beams.add(lashing13);
  const lashing14 = new THREE.Mesh(torusGeo, ropeMat);
  lashing14.name = 'lashing';
  lashing14.position.set(1.122, 0.38, 1.15);
  lashing14.rotation.set(0, deg(90), 0);
  beams.add(lashing14);
  const plank = new THREE.Mesh(boxGeo, cutMat);
  plank.name = 'plank';
  plank.position.set(0.003, 0.36, -0.07);
  plank.rotation.set(0, deg(-3.783), 0);
  beams.add(plank);
  const plank2 = new THREE.Mesh(boxGeo, cutMat);
  plank2.name = 'plank';
  plank2.position.set(-0.0327, 0.36, 0.2);
  plank2.rotation.set(0, deg(2.7415), 0);
  beams.add(plank2);
  const plank3 = new THREE.Mesh(boxGeo, cutMat);
  plank3.name = 'plank';
  plank3.position.set(-0.0012, 0.36, 0.47);
  plank3.rotation.set(0, deg(2.4722), 0);
  beams.add(plank3);
  const mast = new THREE.Group();
  mast.name = 'mast';
  raft.add(mast);
  const mastStep = new THREE.Mesh(new THREE.BoxGeometry(0.34, 0.16, 0.34), crateMat);
  mastStep.name = 'mastStep';
  mastStep.position.set(0, 0.46, 0.2);
  mast.add(mastStep);
  const mastPole = new THREE.Mesh(new THREE.CylinderGeometry(0.065, 0.085, 3.26, 7), barkMat);
  mastPole.name = 'mastPole';
  mastPole.position.set(0, 2.01, 0.2);
  mast.add(mastPole);
  const mastCap = new THREE.Mesh(new THREE.SphereGeometry(0.08, 6, 4), cutMat);
  mastCap.name = 'mastCap';
  mastCap.position.set(0, 3.65, 0.2);
  mast.add(mastCap);
  const stay = new THREE.Mesh(tube([[0, 3.5, 0.2], [1.14, 0.39, 1.55]], 0.014, 1, 3), ropeMat);
  stay.name = 'stay';
  mast.add(stay);
  const stay2 = new THREE.Mesh(tube([[0, 3.5, 0.2], [-1.14, 0.39, 1.55]], 0.014, 1, 3), ropeMat);
  stay2.name = 'stay';
  mast.add(stay2);
  const stay3 = new THREE.Mesh(tube([[0, 3.5, 0.2], [1.14, 0.39, -1.55]], 0.014, 1, 3), ropeMat);
  stay3.name = 'stay';
  mast.add(stay3);
  const stay4 = new THREE.Mesh(tube([[0, 3.5, 0.2], [-1.14, 0.39, -1.55]], 0.014, 1, 3), ropeMat);
  stay4.name = 'stay';
  mast.add(stay4);
  const sail = new THREE.Group();
  sail.name = 'sail';
  sail.position.set(0, 3.25, 0.27);
  raft.add(sail);
  const yard = new THREE.Mesh(new THREE.CylinderGeometry(0.045, 0.045, 2.5, 6), barkMat);
  yard.name = 'yard';
  yard.position.set(0, 0, 0.08);
  yard.rotation.set(0, 0, deg(90));
  sail.add(yard);
  const boom = new THREE.Mesh(new THREE.CylinderGeometry(0.04, 0.04, 2.3, 6), barkMat);
  boom.name = 'boom';
  boom.position.set(0, -1.95, 0.3813);
  boom.rotation.set(0, 0, deg(90));
  sail.add(boom);
  const sailCloth = new THREE.Mesh(new THREE.CylinderGeometry(2.0088, 2.0088, 1.9, 6, 1, true, -0.55, 1.1), sailMat);
  sailCloth.name = 'sailCloth';
  sailCloth.position.set(0, -0.98, -1.6326);
  sail.add(sailCloth);
  const sailPatch = new THREE.Mesh(new THREE.CylinderGeometry(2.0288, 2.0288, 0.55, 2, 1, true, 0.12, 0.28), clothMat);
  sailPatch.name = 'sailPatch';
  sailPatch.position.set(0, -1.178, -1.6326);
  sail.add(sailPatch);
  const boltRope = new THREE.Mesh(tube([[1.15, 0, 0.08], [1, -0.95, 0.32], [1.1, -1.95, 0.3813]], 0.012, 6, 3), ropeMat);
  boltRope.name = 'boltRope';
  sail.add(boltRope);
  const boltRope2 = new THREE.Mesh(tube([[-1.15, 0, 0.08], [-1, -0.95, 0.32], [-1.1, -1.95, 0.3813]], 0.012, 6, 3), ropeMat);
  boltRope2.name = 'boltRope';
  sail.add(boltRope2);
  const lantern = new THREE.Group();
  lantern.name = 'lantern';
  lantern.position.set(-0.99, 0, -1.5);
  raft.add(lantern);
  const lanternPost = new THREE.Mesh(new THREE.CylinderGeometry(0.035, 0.04, 1.2, 6), barkMat);
  lanternPost.name = 'lanternPost';
  lanternPost.position.set(0, 0.94, 0);
  lantern.add(lanternPost);
  const lanternArm = new THREE.Mesh(new THREE.BoxGeometry(0.24, 0.04, 0.04), barkMat);
  lanternArm.name = 'lanternArm';
  lanternArm.position.set(0.1, 1.52, 0);
  lantern.add(lanternArm);
  const lanternGlass = new THREE.Mesh(new THREE.BoxGeometry(0.16, 0.22, 0.16), glowMat);
  lanternGlass.name = 'lanternGlass';
  lanternGlass.position.set(0.18, 1.32, 0);
  lantern.add(lanternGlass);
  const lanternTop = new THREE.Mesh(new THREE.ConeGeometry(0.14, 0.12, 4), darkMat);
  lanternTop.name = 'lanternTop';
  lanternTop.position.set(0.18, 1.49, 0);
  lanternTop.rotation.set(0, deg(45), 0);
  lantern.add(lanternTop);
  const lanternBase = new THREE.Mesh(new THREE.BoxGeometry(0.18, 0.03, 0.18), darkMat);
  lanternBase.name = 'lanternBase';
  lanternBase.position.set(0.18, 1.2, 0);
  lantern.add(lanternBase);
  const supplies = new THREE.Group();
  supplies.name = 'supplies';
  raft.add(supplies);
  const barrel = new THREE.Mesh(lathe([[0, 0], [0.22, 0], [0.26, 0.16], [0.27, 0.32], [0.26, 0.48], [0.22, 0.64], [0, 0.64]], 10), crateMat);
  barrel.name = 'barrel';
  barrel.position.set(-0.74, 0.32, -0.95);
  supplies.add(barrel);
  const torus71 = new THREE.Mesh(torusGeo2, darkMat);
  torus71.position.set(-0.74, 0.44, -0.95);
  torus71.rotation.set(deg(90), 0, 0);
  supplies.add(torus71);
  const torus72 = new THREE.Mesh(torusGeo2, darkMat);
  torus72.position.set(-0.74, 0.84, -0.95);
  torus72.rotation.set(deg(90), 0, 0);
  supplies.add(torus72);
  const crate = new THREE.Mesh(new THREE.BoxGeometry(0.55, 0.42, 0.5), crateMat);
  crate.name = 'crate';
  crate.position.set(0.74, 0.53, -0.9);
  crate.rotation.set(0, deg(14), 0);
  supplies.add(crate);
  const box74 = new THREE.Mesh(new THREE.BoxGeometry(0.57, 0.05, 0.06), darkMat);
  box74.position.set(0.74, 0.765, -0.9);
  box74.rotation.set(0, deg(14), 0);
  supplies.add(box74);
  const sackA = new THREE.Mesh(jitter(new THREE.SphereGeometry(0.27, 7, 5), 0.02, 5), clothMat);
  sackA.name = 'sackA';
  sackA.position.set(0.77, 0.5008, 0.95);
  sackA.scale.set(1, 0.72, 0.85);
  supplies.add(sackA);
  const sackTieA = new THREE.Mesh(new THREE.CylinderGeometry(0.05, 0.07, 0.1, 6), ropeMat);
  sackTieA.name = 'sackTieA';
  sackTieA.position.set(0.77, 0.73, 0.95);
  supplies.add(sackTieA);
  const sackB = new THREE.Mesh(jitter(new THREE.SphereGeometry(0.216, 7, 5), 0.02, 5), clothMat);
  sackB.name = 'sackB';
  sackB.position.set(0.37, 0.4788, 1.25);
  sackB.scale.set(1, 0.72, 0.85);
  supplies.add(sackB);
  const sackTieB = new THREE.Mesh(new THREE.CylinderGeometry(0.04, 0.056, 0.08, 6), ropeMat);
  sackTieB.name = 'sackTieB';
  sackTieB.position.set(0.37, 0.648, 1.25);
  supplies.add(sackTieB);
  const ropeCoil = new THREE.Mesh(new THREE.TorusGeometry(0.17, 0.05, 4, 10), ropeMat);
  ropeCoil.name = 'ropeCoil';
  ropeCoil.position.set(-0.64, 0.38, 1);
  ropeCoil.rotation.set(deg(90), 0, 0);
  supplies.add(ropeCoil);
  const torus80 = new THREE.Mesh(new THREE.TorusGeometry(0.1, 0.045, 4, 8), ropeMat);
  torus80.position.set(-0.64, 0.47, 1);
  torus80.rotation.set(deg(90), 0, 0);
  supplies.add(torus80);
  const paddle = new THREE.Group();
  paddle.name = 'paddle';
  paddle.position.set(-0.2, 0.36, -1.55);
  paddle.rotation.set(0, deg(-8), 0);
  supplies.add(paddle);
  const shaft = new THREE.Mesh(new THREE.CylinderGeometry(0.022, 0.022, 1.3, 6), cutMat);
  shaft.name = 'shaft';
  shaft.rotation.set(0, 0, deg(90));
  paddle.add(shaft);
  const blade = new THREE.Mesh(new THREE.BoxGeometry(0.45, 0.025, 0.2), cutMat);
  blade.name = 'blade';
  blade.position.set(0.85, 0, 0);
  paddle.add(blade);

  root.traverse((o) => {
    if (o.isMesh) {
      o.castShadow = true;
      o.receiveShadow = true;
    }
  });
  return root;
}

export default createRaft;

评分与评论

—
暂无评分,快来抢先评分吧。
5
0
4
0
3
0
2
0
1
0

登录后即可评分和评论。

0 条评论

暂无评论。分享一下你是如何使用这个模型的,或者有哪些可以改进的地方。

相关模型

同一分类或相似标签