Codels
1244 Tris4,04 × 1,03 × 2,03 m

Im Code verwenden

Im Editor remixen
Eigenständiges ES-Modul — hängt nur von three ab. Ruf die Factory auf und füge die Gruppe deiner Szene hinzu.
/**
 * Moving Platform — Codels 3D model library
 * License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
 * Triangles: 1,244 · Size (W × H × D): 4.04 × 1.03 × 2.03 m
 *
 * Usage:
 *   import { createMovingPlatform } from './moving-platform.js';
 *   
 *   const model = createMovingPlatform();
 *   model.position.set(0, 0, 0);
 *   scene.add(model);
 *   
 *   // Animations: idle
 *   const mixer = new THREE.AnimationMixer(model);
 *   mixer.clipAction(THREE.AnimationClip.findByName(model.animations, 'idle')).play();
 *   // in your render loop: mixer.update(clock.getDelta());
 */
import * as THREE from 'three';

const deg = THREE.MathUtils.degToRad;

// Extrude a 2D outline along Z (centered). bevel = [thickness, size, segments].
function extrude(outline, depth, holes = [], bevel = null) {
  const shape = new THREE.Shape(outline.map(([x, y]) => new THREE.Vector2(x, y)));
  for (const hole of holes) shape.holes.push(new THREE.Path(hole.map(([x, y]) => new THREE.Vector2(x, y))));
  const options = bevel
    ? { depth, bevelEnabled: true, bevelThickness: bevel[0], bevelSize: bevel[1], bevelSegments: bevel[2] }
    : { depth, bevelEnabled: false };
  return new THREE.ExtrudeGeometry(shape, options).translate(0, 0, -depth / 2);
}

// Build animation clips from simple descriptions (Codels). Play them with THREE.AnimationMixer.
function codelsClips(THREE, entries) {
  var TAU = Math.PI * 2;
  var DEG = Math.PI / 180;
  var AX = { x: new THREE.Vector3(1, 0, 0), y: new THREE.Vector3(0, 1, 0), z: new THREE.Vector3(0, 0, 1) };
  var periodOf = function (a) { return a.type === 'spin' ? 360 / Math.abs(a.speed) : a.period; };
  var clips = [];

  // loops → 'idle'
  var loops = [];
  entries.forEach(function (e) {
    var l = e.anim.filter(function (a) { return a.type !== 'hinge'; });
    if (l.length) loops.push({ target: e.target, anim: l });
  });
  if (loops.length) {
    var periods = [];
    loops.forEach(function (e) { e.anim.forEach(function (a) { periods.push(periodOf(a)); }); });
    var longest = Math.max.apply(null, periods);
    var D = longest;
    var bestErr = Infinity;
    for (var m = 1; m <= 6 && bestErr > 0.01; m++) {
      var err = 0;
      periods.forEach(function (p) {
        var n = Math.max(1, Math.round((longest * m) / p));
        err = Math.max(err, Math.abs((longest * m) / n - p) / p);
      });
      if (err < bestErr - 1e-9) { bestErr = err; D = longest * m; }
    }
    var cycles = function (a) { return Math.max(1, Math.round(D / periodOf(a))); };
    var steps = 24;
    loops.forEach(function (e) { e.anim.forEach(function (a) { steps = Math.max(steps, cycles(a) * 24); }); });
    steps = Math.min(steps, 720);
    var tracks = [];
    loops.forEach(function (e) {
      var o = e.target;
      var q0 = o.quaternion.clone(), p0 = o.position.clone(), s0 = o.scale.clone();
      var q = new THREE.Quaternion(), turn = new THREE.Quaternion(), p = new THREE.Vector3(), s = new THREE.Vector3();
      var has = function (type) { return e.anim.some(function (a) { return a.type === type; }); };
      var turns = has('spin') || has('swing'), moves = has('bob'), grows = has('pulse');
      var times = [], qv = [], pv = [], sv = [];
      for (var k = 0; k <= steps; k++) {
        var t = (D * k) / steps;
        q.copy(q0); p.copy(p0); s.copy(s0);
        e.anim.forEach(function (a) {
          var n = cycles(a);
          var w = Math.sin(TAU * ((n * t) / D + (a.phase || 0)));
          if (a.type === 'spin') q.multiply(turn.setFromAxisAngle(AX[a.axis], (a.speed < 0 ? -TAU : TAU) * ((n * t) / D)));
          else if (a.type === 'swing') q.multiply(turn.setFromAxisAngle(AX[a.axis], a.angle * DEG * w));
          else if (a.type === 'bob') p.addScaledVector(AX[a.axis], a.distance * w);
          else if (a.type === 'pulse') s.multiplyScalar(1 + a.amount * w);
        });
        times.push(t);
        if (turns) qv.push(q.x, q.y, q.z, q.w);
        if (moves) pv.push(p.x, p.y, p.z);
        if (grows) sv.push(s.x, s.y, s.z);
      }
      if (turns) tracks.push(new THREE.QuaternionKeyframeTrack(o.uuid + '.quaternion', times, qv));
      if (moves) tracks.push(new THREE.VectorKeyframeTrack(o.uuid + '.position', times, pv));
      if (grows) tracks.push(new THREE.VectorKeyframeTrack(o.uuid + '.scale', times, sv));
    });
    clips.push(new THREE.AnimationClip('idle', D, tracks));
  }

  // hinge moves → one-shot clips ('open' …)
  var shots = {};
  entries.forEach(function (e) {
    e.anim.forEach(function (a) {
      if (a.type !== 'hinge') return;
      var name = a.clip || 'open';
      (shots[name] = shots[name] || []).push({ target: e.target, a: a });
    });
  });
  Object.keys(shots).forEach(function (name) {
    var tracks = [];
    var length = 0;
    shots[name].forEach(function (h) {
      var o = h.target, q0 = o.quaternion.clone(), q = new THREE.Quaternion(), turn = new THREE.Quaternion();
      var n = Math.max(4, Math.ceil(Math.abs(h.a.angle) / 10));
      var times = [], qv = [];
      for (var k = 0; k <= n; k++) {
        var f = k / n;
        var eased = f * f * (3 - 2 * f);
        q.copy(q0).multiply(turn.setFromAxisAngle(AX[h.a.axis], h.a.angle * DEG * eased));
        times.push(h.a.duration * f);
        qv.push(q.x, q.y, q.z, q.w);
      }
      length = Math.max(length, h.a.duration);
      tracks.push(new THREE.QuaternionKeyframeTrack(o.uuid + '.quaternion', times, qv));
    });
    clips.push(new THREE.AnimationClip(name, length, tracks));
  });
  return clips;
}

export function createMovingPlatform() {
  const root = new THREE.Group();
  root.name = 'MovingPlatform';

  // Materials
  const frameMat = new THREE.MeshStandardMaterial({ name: 'frame', color: 0x3a4252, roughness: 0.6, metalness: 0.35, flatShading: true });
  const darkMat = new THREE.MeshStandardMaterial({ name: 'dark', color: 0x232831, roughness: 0.7, metalness: 0.3, flatShading: true });
  const steelMat = new THREE.MeshStandardMaterial({ name: 'steel', color: 0xc3cad4, roughness: 0.3, metalness: 0.75, flatShading: true });
  const deckMat = new THREE.MeshStandardMaterial({ name: 'deck', color: 0x3fa7e0, roughness: 0.5, flatShading: true });
  const deckTopMat = new THREE.MeshStandardMaterial({ name: 'deckTop', color: 0x6fbde8, roughness: 0.55, flatShading: true });
  const hazardMat = new THREE.MeshStandardMaterial({ name: 'hazard', color: 0xf5c02a, roughness: 0.55, flatShading: true });
  const stripeMat = new THREE.MeshStandardMaterial({ name: 'stripe', color: 0x1d1f25, roughness: 0.7, flatShading: true });
  const glowMat = new THREE.MeshStandardMaterial({ name: 'glow', color: 0xb8fff4, roughness: 0.4, emissive: 0x3dffd8, emissiveIntensity: 1.1, flatShading: true });

  // Shared geometries
  const boxGeo = new THREE.BoxGeometry(3.5, 0.06, 0.08);
  const boxGeo2 = new THREE.BoxGeometry(0.28, 0.42, 0.9);
  const boxGeo3 = new THREE.BoxGeometry(0.3, 0.06, 0.92);
  const cylinderGeo = new THREE.CylinderGeometry(0.1, 0.1, 0.1, 8);
  const extrudeGeo = extrude([[-0.05, 0], [0.11, 0.16], [0.18, 0.16], [0.02, 0], [0.18, -0.16], [0.11, -0.16]], 0.012);
  const extrudeGeo2 = extrude([[0.05, 0], [-0.11, 0.16], [-0.18, 0.16], [-0.02, 0], [-0.18, -0.16], [-0.11, -0.16]], 0.012);
  const cylinderGeo2 = new THREE.CylinderGeometry(0.035, 0.035, 0.02, 6);
  const boxGeo4 = new THREE.BoxGeometry(1.9, 0.12, 0.012);
  const extrudeGeo3 = extrude([[-0.95, 0.06], [-0.95, -0.04], [-0.85, 0.06]], 0.008);
  const extrudeGeo4 = extrude([[-0.87, -0.06], [-0.77, -0.06], [-0.65, 0.06], [-0.75, 0.06]], 0.008);
  const extrudeGeo5 = extrude([[-0.67, -0.06], [-0.57, -0.06], [-0.45, 0.06], [-0.55, 0.06]], 0.008);
  const extrudeGeo6 = extrude([[-0.47, -0.06], [-0.37, -0.06], [-0.25, 0.06], [-0.35, 0.06]], 0.008);
  const extrudeGeo7 = extrude([[-0.27, -0.06], [-0.17, -0.06], [-0.05, 0.06], [-0.15, 0.06]], 0.008);
  const extrudeGeo8 = extrude([[-0.07, -0.06], [0.03, -0.06], [0.15, 0.06], [0.05, 0.06]], 0.008);
  const extrudeGeo9 = extrude([[0.13, -0.06], [0.23, -0.06], [0.35, 0.06], [0.25, 0.06]], 0.008);
  const extrudeGeo10 = extrude([[0.33, -0.06], [0.43, -0.06], [0.55, 0.06], [0.45, 0.06]], 0.008);
  const extrudeGeo11 = extrude([[0.53, -0.06], [0.63, -0.06], [0.75, 0.06], [0.65, 0.06]], 0.008);
  const extrudeGeo12 = extrude([[0.73, -0.06], [0.83, -0.06], [0.95, 0.06], [0.85, 0.06]], 0.008);
  const extrudeGeo13 = extrude([[0.95, -0.04], [0.93, -0.06], [0.95, -0.06]], 0.008);
  const boxGeo5 = new THREE.BoxGeometry(0.012, 0.06, 1.7);
  const cylinderGeo3 = new THREE.CylinderGeometry(0.09, 0.09, 0.06, 10);

  // Parts
  const trackBase = new THREE.Mesh(new THREE.BoxGeometry(4, 0.14, 0.76), frameMat);
  trackBase.name = 'trackBase';
  trackBase.position.set(0, 0.07, 0);
  root.add(trackBase);
  const trackFoot = new THREE.Mesh(new THREE.BoxGeometry(4.04, 0.05, 0.8), darkMat);
  trackFoot.name = 'trackFoot';
  trackFoot.position.set(0, 0.025, 0);
  root.add(trackFoot);
  const railBack = new THREE.Mesh(boxGeo, steelMat);
  railBack.name = 'railBack';
  railBack.position.set(0, 0.17, -0.24);
  root.add(railBack);
  const railFront = new THREE.Mesh(boxGeo, steelMat);
  railFront.name = 'railFront';
  railFront.position.set(0, 0.17, 0.24);
  root.add(railFront);
  const box5 = new THREE.Mesh(new THREE.BoxGeometry(3.94, 0.07, 0.012), hazardMat);
  box5.position.set(0, 0.09, 0.386);
  root.add(box5);
  const trackStripes = new THREE.Group();
  trackStripes.name = 'trackStripes';
  trackStripes.position.set(0, 0.09, 0.392);
  root.add(trackStripes);
  const extrude7 = new THREE.Mesh(extrude([[-1.97, 0.035], [-1.97, -0.035], [-1.96, -0.035], [-1.89, 0.035]], 0.008), stripeMat);
  extrude7.position.set(0, 0, 0.004);
  trackStripes.add(extrude7);
  const extrude8 = new THREE.Mesh(extrude([[-1.88, -0.035], [-1.8, -0.035], [-1.73, 0.035], [-1.81, 0.035]], 0.008), stripeMat);
  extrude8.position.set(0, 0, 0.004);
  trackStripes.add(extrude8);
  const extrude9 = new THREE.Mesh(extrude([[-1.72, -0.035], [-1.64, -0.035], [-1.57, 0.035], [-1.65, 0.035]], 0.008), stripeMat);
  extrude9.position.set(0, 0, 0.004);
  trackStripes.add(extrude9);
  const extrude10 = new THREE.Mesh(extrude([[-1.56, -0.035], [-1.48, -0.035], [-1.41, 0.035], [-1.49, 0.035]], 0.008), stripeMat);
  extrude10.position.set(0, 0, 0.004);
  trackStripes.add(extrude10);
  const extrude11 = new THREE.Mesh(extrude([[-1.4, -0.035], [-1.32, -0.035], [-1.25, 0.035], [-1.33, 0.035]], 0.008), stripeMat);
  extrude11.position.set(0, 0, 0.004);
  trackStripes.add(extrude11);
  const extrude12 = new THREE.Mesh(extrude([[-1.24, -0.035], [-1.16, -0.035], [-1.09, 0.035], [-1.17, 0.035]], 0.008), stripeMat);
  extrude12.position.set(0, 0, 0.004);
  trackStripes.add(extrude12);
  const extrude13 = new THREE.Mesh(extrude([[-1.08, -0.035], [-1, -0.035], [-0.93, 0.035], [-1.01, 0.035]], 0.008), stripeMat);
  extrude13.position.set(0, 0, 0.004);
  trackStripes.add(extrude13);
  const extrude14 = new THREE.Mesh(extrude([[-0.92, -0.035], [-0.84, -0.035], [-0.77, 0.035], [-0.85, 0.035]], 0.008), stripeMat);
  extrude14.position.set(0, 0, 0.004);
  trackStripes.add(extrude14);
  const extrude15 = new THREE.Mesh(extrude([[-0.76, -0.035], [-0.68, -0.035], [-0.61, 0.035], [-0.69, 0.035]], 0.008), stripeMat);
  extrude15.position.set(0, 0, 0.004);
  trackStripes.add(extrude15);
  const extrude16 = new THREE.Mesh(extrude([[-0.6, -0.035], [-0.52, -0.035], [-0.45, 0.035], [-0.53, 0.035]], 0.008), stripeMat);
  extrude16.position.set(0, 0, 0.004);
  trackStripes.add(extrude16);
  const extrude17 = new THREE.Mesh(extrude([[-0.44, -0.035], [-0.36, -0.035], [-0.29, 0.035], [-0.37, 0.035]], 0.008), stripeMat);
  extrude17.position.set(0, 0, 0.004);
  trackStripes.add(extrude17);
  const extrude18 = new THREE.Mesh(extrude([[-0.28, -0.035], [-0.2, -0.035], [-0.13, 0.035], [-0.21, 0.035]], 0.008), stripeMat);
  extrude18.position.set(0, 0, 0.004);
  trackStripes.add(extrude18);
  const extrude19 = new THREE.Mesh(extrude([[-0.12, -0.035], [-0.04, -0.035], [0.03, 0.035], [-0.05, 0.035]], 0.008), stripeMat);
  extrude19.position.set(0, 0, 0.004);
  trackStripes.add(extrude19);
  const extrude20 = new THREE.Mesh(extrude([[0.04, -0.035], [0.12, -0.035], [0.19, 0.035], [0.11, 0.035]], 0.008), stripeMat);
  extrude20.position.set(0, 0, 0.004);
  trackStripes.add(extrude20);
  const extrude21 = new THREE.Mesh(extrude([[0.2, -0.035], [0.28, -0.035], [0.35, 0.035], [0.27, 0.035]], 0.008), stripeMat);
  extrude21.position.set(0, 0, 0.004);
  trackStripes.add(extrude21);
  const extrude22 = new THREE.Mesh(extrude([[0.36, -0.035], [0.44, -0.035], [0.51, 0.035], [0.43, 0.035]], 0.008), stripeMat);
  extrude22.position.set(0, 0, 0.004);
  trackStripes.add(extrude22);
  const extrude23 = new THREE.Mesh(extrude([[0.52, -0.035], [0.6, -0.035], [0.67, 0.035], [0.59, 0.035]], 0.008), stripeMat);
  extrude23.position.set(0, 0, 0.004);
  trackStripes.add(extrude23);
  const extrude24 = new THREE.Mesh(extrude([[0.68, -0.035], [0.76, -0.035], [0.83, 0.035], [0.75, 0.035]], 0.008), stripeMat);
  extrude24.position.set(0, 0, 0.004);
  trackStripes.add(extrude24);
  const extrude25 = new THREE.Mesh(extrude([[0.84, -0.035], [0.92, -0.035], [0.99, 0.035], [0.91, 0.035]], 0.008), stripeMat);
  extrude25.position.set(0, 0, 0.004);
  trackStripes.add(extrude25);
  const extrude26 = new THREE.Mesh(extrude([[1, -0.035], [1.08, -0.035], [1.15, 0.035], [1.07, 0.035]], 0.008), stripeMat);
  extrude26.position.set(0, 0, 0.004);
  trackStripes.add(extrude26);
  const extrude27 = new THREE.Mesh(extrude([[1.16, -0.035], [1.24, -0.035], [1.31, 0.035], [1.23, 0.035]], 0.008), stripeMat);
  extrude27.position.set(0, 0, 0.004);
  trackStripes.add(extrude27);
  const extrude28 = new THREE.Mesh(extrude([[1.32, -0.035], [1.4, -0.035], [1.47, 0.035], [1.39, 0.035]], 0.008), stripeMat);
  extrude28.position.set(0, 0, 0.004);
  trackStripes.add(extrude28);
  const extrude29 = new THREE.Mesh(extrude([[1.48, -0.035], [1.56, -0.035], [1.63, 0.035], [1.55, 0.035]], 0.008), stripeMat);
  extrude29.position.set(0, 0, 0.004);
  trackStripes.add(extrude29);
  const extrude30 = new THREE.Mesh(extrude([[1.64, -0.035], [1.72, -0.035], [1.79, 0.035], [1.71, 0.035]], 0.008), stripeMat);
  extrude30.position.set(0, 0, 0.004);
  trackStripes.add(extrude30);
  const extrude31 = new THREE.Mesh(extrude([[1.8, -0.035], [1.88, -0.035], [1.95, 0.035], [1.87, 0.035]], 0.008), stripeMat);
  extrude31.position.set(0, 0, 0.004);
  trackStripes.add(extrude31);
  const extrude32 = new THREE.Mesh(extrude([[1.97, -0.025], [1.96, -0.035], [1.97, -0.035]], 0.008), stripeMat);
  extrude32.position.set(0, 0, 0.004);
  trackStripes.add(extrude32);
  const bufferLeft = new THREE.Mesh(boxGeo2, darkMat);
  bufferLeft.name = 'bufferLeft';
  bufferLeft.position.set(-1.86, 0.21, 0);
  root.add(bufferLeft);
  const box34 = new THREE.Mesh(boxGeo3, hazardMat);
  box34.position.set(-1.86, 0.45, 0);
  root.add(box34);
  const cylinder35 = new THREE.Mesh(cylinderGeo, hazardMat);
  cylinder35.position.set(-1.67, 0.28, 0);
  cylinder35.rotation.set(0, 0, deg(90));
  root.add(cylinder35);
  const bufferRight = new THREE.Mesh(boxGeo2, darkMat);
  bufferRight.name = 'bufferRight';
  bufferRight.position.set(1.86, 0.21, 0);
  root.add(bufferRight);
  const box37 = new THREE.Mesh(boxGeo3, hazardMat);
  box37.position.set(1.86, 0.45, 0);
  root.add(box37);
  const cylinder38 = new THREE.Mesh(cylinderGeo, hazardMat);
  cylinder38.position.set(1.67, 0.28, 0);
  cylinder38.rotation.set(0, 0, deg(90));
  root.add(cylinder38);
  const arrowL1 = new THREE.Mesh(extrudeGeo, glowMat);
  arrowL1.name = 'arrowL1';
  arrowL1.position.set(-0.45, 0.146, 0);
  arrowL1.rotation.set(deg(-90), 0, 0);
  root.add(arrowL1);
  const arrowR1 = new THREE.Mesh(extrudeGeo2, glowMat);
  arrowR1.name = 'arrowR1';
  arrowR1.position.set(0.45, 0.146, 0);
  arrowR1.rotation.set(deg(-90), 0, 0);
  root.add(arrowR1);
  const arrowL2 = new THREE.Mesh(extrudeGeo, glowMat);
  arrowL2.name = 'arrowL2';
  arrowL2.position.set(-0.9, 0.146, 0);
  arrowL2.rotation.set(deg(-90), 0, 0);
  root.add(arrowL2);
  const arrowR2 = new THREE.Mesh(extrudeGeo2, glowMat);
  arrowR2.name = 'arrowR2';
  arrowR2.position.set(0.9, 0.146, 0);
  arrowR2.rotation.set(deg(-90), 0, 0);
  root.add(arrowR2);
  const arrowL3 = new THREE.Mesh(extrudeGeo, glowMat);
  arrowL3.name = 'arrowL3';
  arrowL3.position.set(-1.35, 0.146, 0);
  arrowL3.rotation.set(deg(-90), 0, 0);
  root.add(arrowL3);
  const arrowR3 = new THREE.Mesh(extrudeGeo2, glowMat);
  arrowR3.name = 'arrowR3';
  arrowR3.position.set(1.35, 0.146, 0);
  arrowR3.rotation.set(deg(-90), 0, 0);
  root.add(arrowR3);
  const platform = new THREE.Group();
  platform.name = 'platform';
  platform.position.set(0, 0.7, 0);
  root.add(platform);
  const deckBody = new THREE.Mesh(new THREE.BoxGeometry(2, 0.24, 2), frameMat);
  deckBody.name = 'deckBody';
  deckBody.position.set(0, 0.12, 0);
  platform.add(deckBody);
  const deckTop = new THREE.Mesh(new THREE.BoxGeometry(1.92, 0.07, 1.92), deckMat);
  deckTop.name = 'deckTop';
  deckTop.position.set(0, 0.275, 0);
  platform.add(deckTop);
  const deckInset = new THREE.Mesh(new THREE.BoxGeometry(1.5, 0.012, 1.5), deckTopMat);
  deckInset.name = 'deckInset';
  deckInset.position.set(0, 0.316, 0);
  platform.add(deckInset);
  const cylinder49 = new THREE.Mesh(cylinderGeo2, steelMat);
  cylinder49.position.set(-0.84, 0.32, -0.84);
  platform.add(cylinder49);
  const cylinder50 = new THREE.Mesh(cylinderGeo2, steelMat);
  cylinder50.position.set(0.84, 0.32, -0.84);
  platform.add(cylinder50);
  const cylinder51 = new THREE.Mesh(cylinderGeo2, steelMat);
  cylinder51.position.set(0.84, 0.32, 0.84);
  platform.add(cylinder51);
  const cylinder52 = new THREE.Mesh(cylinderGeo2, steelMat);
  cylinder52.position.set(-0.84, 0.32, 0.84);
  platform.add(cylinder52);
  const box53 = new THREE.Mesh(boxGeo4, hazardMat);
  box53.position.set(0, 0.12, 1.003);
  platform.add(box53);
  const deckStripesFront = new THREE.Group();
  deckStripesFront.name = 'deckStripesFront';
  deckStripesFront.position.set(0, 0.12, 1.009);
  platform.add(deckStripesFront);
  const extrude55 = new THREE.Mesh(extrudeGeo3, stripeMat);
  extrude55.position.set(0, 0, 0.004);
  deckStripesFront.add(extrude55);
  const extrude56 = new THREE.Mesh(extrudeGeo4, stripeMat);
  extrude56.position.set(0, 0, 0.004);
  deckStripesFront.add(extrude56);
  const extrude57 = new THREE.Mesh(extrudeGeo5, stripeMat);
  extrude57.position.set(0, 0, 0.004);
  deckStripesFront.add(extrude57);
  const extrude58 = new THREE.Mesh(extrudeGeo6, stripeMat);
  extrude58.position.set(0, 0, 0.004);
  deckStripesFront.add(extrude58);
  const extrude59 = new THREE.Mesh(extrudeGeo7, stripeMat);
  extrude59.position.set(0, 0, 0.004);
  deckStripesFront.add(extrude59);
  const extrude60 = new THREE.Mesh(extrudeGeo8, stripeMat);
  extrude60.position.set(0, 0, 0.004);
  deckStripesFront.add(extrude60);
  const extrude61 = new THREE.Mesh(extrudeGeo9, stripeMat);
  extrude61.position.set(0, 0, 0.004);
  deckStripesFront.add(extrude61);
  const extrude62 = new THREE.Mesh(extrudeGeo10, stripeMat);
  extrude62.position.set(0, 0, 0.004);
  deckStripesFront.add(extrude62);
  const extrude63 = new THREE.Mesh(extrudeGeo11, stripeMat);
  extrude63.position.set(0, 0, 0.004);
  deckStripesFront.add(extrude63);
  const extrude64 = new THREE.Mesh(extrudeGeo12, stripeMat);
  extrude64.position.set(0, 0, 0.004);
  deckStripesFront.add(extrude64);
  const extrude65 = new THREE.Mesh(extrudeGeo13, stripeMat);
  extrude65.position.set(0, 0, 0.004);
  deckStripesFront.add(extrude65);
  const glowRight = new THREE.Mesh(boxGeo5, glowMat);
  glowRight.name = 'glowRight';
  glowRight.position.set(1.004, 0.12, 0);
  platform.add(glowRight);
  const box67 = new THREE.Mesh(boxGeo4, hazardMat);
  box67.position.set(0, 0.12, -1.003);
  platform.add(box67);
  const deckStripesBack = new THREE.Group();
  deckStripesBack.name = 'deckStripesBack';
  deckStripesBack.position.set(0, 0.12, -1.009);
  deckStripesBack.rotation.set(0, deg(180), 0);
  platform.add(deckStripesBack);
  const extrude69 = new THREE.Mesh(extrudeGeo3, stripeMat);
  extrude69.position.set(0, 0, 0.004);
  deckStripesBack.add(extrude69);
  const extrude70 = new THREE.Mesh(extrudeGeo4, stripeMat);
  extrude70.position.set(0, 0, 0.004);
  deckStripesBack.add(extrude70);
  const extrude71 = new THREE.Mesh(extrudeGeo5, stripeMat);
  extrude71.position.set(0, 0, 0.004);
  deckStripesBack.add(extrude71);
  const extrude72 = new THREE.Mesh(extrudeGeo6, stripeMat);
  extrude72.position.set(0, 0, 0.004);
  deckStripesBack.add(extrude72);
  const extrude73 = new THREE.Mesh(extrudeGeo7, stripeMat);
  extrude73.position.set(0, 0, 0.004);
  deckStripesBack.add(extrude73);
  const extrude74 = new THREE.Mesh(extrudeGeo8, stripeMat);
  extrude74.position.set(0, 0, 0.004);
  deckStripesBack.add(extrude74);
  const extrude75 = new THREE.Mesh(extrudeGeo9, stripeMat);
  extrude75.position.set(0, 0, 0.004);
  deckStripesBack.add(extrude75);
  const extrude76 = new THREE.Mesh(extrudeGeo10, stripeMat);
  extrude76.position.set(0, 0, 0.004);
  deckStripesBack.add(extrude76);
  const extrude77 = new THREE.Mesh(extrudeGeo11, stripeMat);
  extrude77.position.set(0, 0, 0.004);
  deckStripesBack.add(extrude77);
  const extrude78 = new THREE.Mesh(extrudeGeo12, stripeMat);
  extrude78.position.set(0, 0, 0.004);
  deckStripesBack.add(extrude78);
  const extrude79 = new THREE.Mesh(extrudeGeo13, stripeMat);
  extrude79.position.set(0, 0, 0.004);
  deckStripesBack.add(extrude79);
  const glowLeft = new THREE.Mesh(boxGeo5, glowMat);
  glowLeft.name = 'glowLeft';
  glowLeft.position.set(-1.004, 0.12, 0);
  platform.add(glowLeft);
  const column = new THREE.Mesh(new THREE.CylinderGeometry(0.15, 0.17, 0.36, 8), steelMat);
  column.name = 'column';
  column.position.set(0, -0.18, 0);
  platform.add(column);
  const carriage = new THREE.Mesh(new THREE.BoxGeometry(1, 0.2, 0.86), darkMat);
  carriage.name = 'carriage';
  carriage.position.set(0, -0.46, 0);
  platform.add(carriage);
  const carriageCap = new THREE.Mesh(new THREE.BoxGeometry(0.86, 0.04, 0.72), hazardMat);
  carriageCap.name = 'carriageCap';
  carriageCap.position.set(0, -0.34, 0);
  platform.add(carriageCap);
  const cylinder84 = new THREE.Mesh(cylinderGeo3, steelMat);
  cylinder84.position.set(-0.32, -0.48, -0.45);
  cylinder84.rotation.set(deg(90), 0, 0);
  platform.add(cylinder84);
  const cylinder85 = new THREE.Mesh(cylinderGeo3, steelMat);
  cylinder85.position.set(-0.32, -0.48, 0.45);
  cylinder85.rotation.set(deg(90), 0, 0);
  platform.add(cylinder85);
  const cylinder86 = new THREE.Mesh(cylinderGeo3, steelMat);
  cylinder86.position.set(0.32, -0.48, -0.45);
  cylinder86.rotation.set(deg(90), 0, 0);
  platform.add(cylinder86);
  const cylinder87 = new THREE.Mesh(cylinderGeo3, steelMat);
  cylinder87.position.set(0.32, -0.48, 0.45);
  cylinder87.rotation.set(deg(90), 0, 0);
  platform.add(cylinder87);

  // Animations ('idle') — play them with THREE.AnimationMixer
  root.animations = codelsClips(THREE, [
    { target: platform, anim: [{ type: 'bob', axis: 'x', distance: 1, period: 4 }] },
  ]);

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

export default createMovingPlatform;

Bewertungen & Kommentare

—
Noch keine Bewertungen — gib die erste ab.
5
0
4
0
3
0
2
0
1
0

Melde dich an, um zu bewerten und zu kommentieren.

0 Kommentare

Noch keine Kommentare. Erzähl, wie du dieses Modell genutzt hast oder was besser sein könnte.

Ähnliche Modelle

Gleiche Kategorie oder ähnliche Tags