Codels
3 B üçgen1,96 × 1,67 × 5,29 m
Bağımsız bir ES modülü — yalnızca three paketine bağımlıdır. Fabrika fonksiyonunu çağırıp dönen grubu sahnene ekle.
/**
 * Police Car — Codels 3D model library
 * License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
 * Triangles: 3,020 · Size (W × H × D): 1.96 × 1.67 × 5.29 m
 *
 * Usage:
 *   import { createPoliceCar } from './police-car.js';
 *   
 *   const model = createPoliceCar();
 *   model.position.set(0, 0, 0);
 *   scene.add(model);
 */
import * as THREE from 'three';

const deg = THREE.MathUtils.degToRad;

// 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);
}

// 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);
}

export function createPoliceCar() {
  const root = new THREE.Group();
  root.name = 'PoliceCar';

  // Materials
  const paintMat = new THREE.MeshStandardMaterial({ name: 'paint', color: 0x1c1e23, roughness: 0.4, metalness: 0.15, flatShading: true });
  const panelMat = new THREE.MeshStandardMaterial({ name: 'panel', color: 0xf2f2ee, roughness: 0.45, metalness: 0.1, flatShading: true });
  const glassMat = new THREE.MeshStandardMaterial({ name: 'glass', color: 0x2a3644, roughness: 0.2, metalness: 0.3, flatShading: true });
  const trimMat = new THREE.MeshStandardMaterial({ name: 'trim', color: 0x222428, roughness: 0.8, flatShading: true });
  const chromeMat = new THREE.MeshStandardMaterial({ name: 'chrome', color: 0xc9cdd3, roughness: 0.3, metalness: 0.65, flatShading: true });
  const goldMat = new THREE.MeshStandardMaterial({ name: 'gold', color: 0xe0a92c, roughness: 0.35, metalness: 0.6, flatShading: true });
  const headlightMat = new THREE.MeshStandardMaterial({ name: 'headlight', color: 0xfff4d6, roughness: 0.3, emissive: 0xffe2a0, emissiveIntensity: 0.9, flatShading: true });
  const taillightMat = new THREE.MeshStandardMaterial({ name: 'taillight', color: 0xd81e28, roughness: 0.3, emissive: 0xff2020, emissiveIntensity: 0.7, flatShading: true });
  const lightRedMat = new THREE.MeshStandardMaterial({ name: 'lightRed', color: 0xff3036, roughness: 0.3, emissive: 0xff1a1a, emissiveIntensity: 1.2, flatShading: true });
  const lightBlueMat = new THREE.MeshStandardMaterial({ name: 'lightBlue', color: 0x3a7bff, roughness: 0.3, emissive: 0x2266ff, emissiveIntensity: 1.2, flatShading: true });

  // Shared geometries
  const extrudeGeo = extrude([[0.8473, 1], [0.3964, 1.37], [-0.17, 1.37], [-0.17, 1]], 0.02);
  const extrudeGeo2 = extrude([[-0.27, 1], [-0.27, 1.37], [-0.8379, 1.37], [-1.2368, 1]], 0.02);
  const boxGeo = new THREE.BoxGeometry(0.38, 0.13, 0.05);
  const boxGeo2 = new THREE.BoxGeometry(0.12, 0.08, 0.05);
  const boxGeo3 = new THREE.BoxGeometry(0.42, 0.13, 0.05);
  const boxGeo4 = new THREE.BoxGeometry(0.13, 0.09, 0.15);
  const boxGeo5 = new THREE.BoxGeometry(0.006, 0.6, 0.014);
  const boxGeo6 = new THREE.BoxGeometry(0.02, 0.03, 0.14);
  const boxGeo7 = new THREE.BoxGeometry(0.05, 0.1, 1.95);
  const boxGeo8 = new THREE.BoxGeometry(0.7, 0.025, 0.02);
  const boxGeo9 = new THREE.BoxGeometry(1.96, 0.17, 0.24);
  const boxGeo10 = new THREE.BoxGeometry(0.36, 0.11, 0.02);
  const boxGeo11 = new THREE.BoxGeometry(0.008, 0.6, 1.96);
  const boxGeo12 = new THREE.BoxGeometry(0.006, 0.58, 0.014);
  const extrudeGeo3 = extrude([[0, 0.12], [-0.0294, 0.0405], [-0.1141, 0.0371], [-0.0476, -0.0155], [-0.0705, -0.0971], [0, -0.05], [0.0705, -0.0971], [0.0476, -0.0155], [0.1141, 0.0371], [0.0294, 0.0405]], 0.012);
  const boxGeo13 = new THREE.BoxGeometry(0.022, 0.12, 0.008);
  const boxGeo14 = new THREE.BoxGeometry(0.085, 0.022, 0.008);
  const boxGeo15 = new THREE.BoxGeometry(0.022, 0.06, 0.008);
  const boxGeo16 = new THREE.BoxGeometry(0.063, 0.022, 0.008);
  const boxGeo17 = new THREE.BoxGeometry(0.08, 0.04, 0.3);
  const boxGeo18 = new THREE.BoxGeometry(0.62, 0.1, 0.26);
  const boxGeo19 = new THREE.BoxGeometry(0.04, 0.11, 0.27);
  const boxGeo20 = new THREE.BoxGeometry(0.02, 0.105, 0.265);
  const boxGeo21 = new THREE.BoxGeometry(0.07, 0.56, 0.06);
  const boxGeo22 = new THREE.BoxGeometry(0.06, 0.06, 0.2);
  const boxGeo23 = new THREE.BoxGeometry(0.86, 0.07, 0.07);
  const boxGeo24 = new THREE.BoxGeometry(0.24, 0.035, 0.03);
  const latheGeo = lathe([[0.2232, -0.095], [0.2232, -0.125], [0.3215, -0.125], [0.36, -0.07], [0.36, 0.07], [0.3215, 0.125], [0.2232, 0.125], [0.2232, 0.095]], 14, 0.2244, Math.PI * 2);
  const cylinderGeo = new THREE.CylinderGeometry(0.2232, 0.2232, 0.19, 14);
  const cylinderGeo2 = new THREE.CylinderGeometry(0.1228, 0.1384, 0.03, 10);
  const cylinderGeo3 = new THREE.CylinderGeometry(0.0446, 0.058, 0.04, 8);

  // Parts
  const body = new THREE.Group();
  body.name = 'body';
  root.add(body);
  const lowerBody = new THREE.Mesh(extrude([[2.36, 0.26], [2.44, 0.36], [2.45, 0.7], [2.38, 0.84], [1.9, 0.9], [1.1, 0.95], [-1.5, 0.96], [-2.3, 0.95], [-2.42, 0.86], [-2.45, 0.42], [-2.36, 0.26], [-1.8785, 0.26], [-1.8793, 0.4563], [-1.7947, 0.6335], [-1.6414, 0.7562], [-1.45, 0.8], [-1.2586, 0.7562], [-1.1053, 0.6335], [-1.0207, 0.4563], [-1.0215, 0.26], [1.0215, 0.26], [1.0207, 0.4563], [1.1053, 0.6335], [1.2586, 0.7562], [1.45, 0.8], [1.6414, 0.7562], [1.7947, 0.6335], [1.8793, 0.4563], [1.8785, 0.26]], 1.82, [], [0.04, 0.04, 2]), paintMat);
  lowerBody.name = 'lowerBody';
  lowerBody.rotation.set(0, deg(-90), 0);
  body.add(lowerBody);
  const chassis = new THREE.Mesh(new THREE.BoxGeometry(1.3, 0.5, 4.4), trimMat);
  chassis.name = 'chassis';
  chassis.position.set(0, 0.56, 0);
  body.add(chassis);
  const cabin = new THREE.Mesh(extrude([[1.1, 0.88], [0.4, 1.43], [-0.85, 1.43], [-1.45, 0.9]], 1.5, [], [0.05, 0.05, 2]), panelMat);
  cabin.name = 'cabin';
  cabin.rotation.set(0, deg(-90), 0);
  body.add(cabin);
  const windowFL = new THREE.Mesh(extrudeGeo, glassMat);
  windowFL.name = 'windowFL';
  windowFL.position.set(0.805, 0, 0);
  windowFL.rotation.set(0, deg(-90), 0);
  body.add(windowFL);
  const windowRL = new THREE.Mesh(extrudeGeo2, glassMat);
  windowRL.name = 'windowRL';
  windowRL.position.set(0.805, 0, 0);
  windowRL.rotation.set(0, deg(-90), 0);
  body.add(windowRL);
  const windowFR = new THREE.Mesh(extrudeGeo, glassMat);
  windowFR.name = 'windowFR';
  windowFR.position.set(-0.805, 0, 0);
  windowFR.rotation.set(0, deg(-90), 0);
  body.add(windowFR);
  const windowRR = new THREE.Mesh(extrudeGeo2, glassMat);
  windowRR.name = 'windowRR';
  windowRR.position.set(-0.805, 0, 0);
  windowRR.rotation.set(0, deg(-90), 0);
  body.add(windowRR);
  const windshield = new THREE.Mesh(new THREE.BoxGeometry(1.42, 0.02, 0.6636), glassMat);
  windshield.name = 'windshield';
  windshield.position.set(0, 1.2253, 0.7641);
  windshield.rotation.set(deg(-141.8428), 0, 0);
  body.add(windshield);
  const rearWindow = new THREE.Mesh(new THREE.BoxGeometry(1.42, 0.02, 0.5891), glassMat);
  rearWindow.name = 'rearWindow';
  rearWindow.position.set(0, 1.243, -1.1584);
  rearWindow.rotation.set(deg(138.5448), 0, 0);
  body.add(rearWindow);
  const headlightL = new THREE.Mesh(boxGeo, headlightMat);
  headlightL.name = 'headlightL';
  headlightL.position.set(0.64, 0.62, 2.49);
  body.add(headlightL);
  const indicatorL = new THREE.Mesh(boxGeo2, goldMat);
  indicatorL.name = 'indicatorL';
  indicatorL.position.set(0.86, 0.47, 2.47);
  body.add(indicatorL);
  const taillightL = new THREE.Mesh(boxGeo3, taillightMat);
  taillightL.name = 'taillightL';
  taillightL.position.set(0.6, 0.78, -2.49);
  body.add(taillightL);
  const mirrorL = new THREE.Mesh(boxGeo4, paintMat);
  mirrorL.name = 'mirrorL';
  mirrorL.position.set(0.88, 1.04, 0.8);
  body.add(mirrorL);
  const box15 = new THREE.Mesh(boxGeo5, trimMat);
  box15.position.set(0.953, 0.62, 1);
  body.add(box15);
  const box16 = new THREE.Mesh(boxGeo5, trimMat);
  box16.position.set(0.953, 0.62, -0.22);
  body.add(box16);
  const box17 = new THREE.Mesh(boxGeo5, trimMat);
  box17.position.set(0.953, 0.62, -1.05);
  body.add(box17);
  const box18 = new THREE.Mesh(boxGeo6, chromeMat);
  box18.position.set(0.96, 0.84, 0.42);
  body.add(box18);
  const box19 = new THREE.Mesh(boxGeo6, chromeMat);
  box19.position.set(0.96, 0.84, -0.62);
  body.add(box19);
  const skirtL = new THREE.Mesh(boxGeo7, trimMat);
  skirtL.name = 'skirtL';
  skirtL.position.set(0.94, 0.27, 0);
  body.add(skirtL);
  const headlightR = new THREE.Mesh(boxGeo, headlightMat);
  headlightR.name = 'headlightR';
  headlightR.position.set(-0.64, 0.62, 2.49);
  body.add(headlightR);
  const indicatorR = new THREE.Mesh(boxGeo2, goldMat);
  indicatorR.name = 'indicatorR';
  indicatorR.position.set(-0.86, 0.47, 2.47);
  body.add(indicatorR);
  const taillightR = new THREE.Mesh(boxGeo3, taillightMat);
  taillightR.name = 'taillightR';
  taillightR.position.set(-0.6, 0.78, -2.49);
  body.add(taillightR);
  const mirrorR = new THREE.Mesh(boxGeo4, paintMat);
  mirrorR.name = 'mirrorR';
  mirrorR.position.set(-0.88, 1.04, 0.8);
  body.add(mirrorR);
  const box25 = new THREE.Mesh(boxGeo5, trimMat);
  box25.position.set(-0.953, 0.62, 1);
  body.add(box25);
  const box26 = new THREE.Mesh(boxGeo5, trimMat);
  box26.position.set(-0.953, 0.62, -0.22);
  body.add(box26);
  const box27 = new THREE.Mesh(boxGeo5, trimMat);
  box27.position.set(-0.953, 0.62, -1.05);
  body.add(box27);
  const box28 = new THREE.Mesh(boxGeo6, chromeMat);
  box28.position.set(-0.96, 0.84, 0.42);
  body.add(box28);
  const box29 = new THREE.Mesh(boxGeo6, chromeMat);
  box29.position.set(-0.96, 0.84, -0.62);
  body.add(box29);
  const skirtR = new THREE.Mesh(boxGeo7, trimMat);
  skirtR.name = 'skirtR';
  skirtR.position.set(-0.94, 0.27, 0);
  body.add(skirtR);
  const grille = new THREE.Mesh(new THREE.BoxGeometry(0.78, 0.18, 0.04), chromeMat);
  grille.name = 'grille';
  grille.position.set(0, 0.6, 2.495);
  body.add(grille);
  const box32 = new THREE.Mesh(boxGeo8, trimMat);
  box32.position.set(0, 0.54, 2.52);
  body.add(box32);
  const box33 = new THREE.Mesh(boxGeo8, trimMat);
  box33.position.set(0, 0.6, 2.52);
  body.add(box33);
  const box34 = new THREE.Mesh(boxGeo8, trimMat);
  box34.position.set(0, 0.66, 2.52);
  body.add(box34);
  const bumperFront = new THREE.Mesh(boxGeo9, trimMat);
  bumperFront.name = 'bumperFront';
  bumperFront.position.set(0, 0.34, 2.46);
  body.add(bumperFront);
  const bumperRear = new THREE.Mesh(boxGeo9, trimMat);
  bumperRear.name = 'bumperRear';
  bumperRear.position.set(0, 0.36, -2.46);
  body.add(bumperRear);
  const plateFront = new THREE.Mesh(boxGeo10, chromeMat);
  plateFront.name = 'plateFront';
  plateFront.position.set(0, 0.34, 2.59);
  body.add(plateFront);
  const plateRear = new THREE.Mesh(boxGeo10, chromeMat);
  plateRear.name = 'plateRear';
  plateRear.position.set(0, 0.56, -2.502);
  body.add(plateRear);
  const doorPanelL = new THREE.Mesh(boxGeo11, panelMat);
  doorPanelL.name = 'doorPanelL';
  doorPanelL.position.set(0.954, 0.62, -0.02);
  body.add(doorPanelL);
  const box40 = new THREE.Mesh(boxGeo12, trimMat);
  box40.position.set(0.96, 0.62, 0.98);
  body.add(box40);
  const box41 = new THREE.Mesh(boxGeo12, trimMat);
  box41.position.set(0.96, 0.62, -0.22);
  body.add(box41);
  const box42 = new THREE.Mesh(boxGeo12, trimMat);
  box42.position.set(0.96, 0.62, -1);
  body.add(box42);
  const badgeL = new THREE.Mesh(extrudeGeo3, goldMat);
  badgeL.name = 'badgeL';
  badgeL.position.set(0.964, 0.66, 0.44);
  badgeL.rotation.set(0, deg(90), 0);
  body.add(badgeL);
  const letteringL = new THREE.Group();
  letteringL.name = 'letteringL';
  letteringL.position.set(0.962, 0.62, -0.6);
  letteringL.rotation.set(0, deg(90), 0);
  body.add(letteringL);
  const box45 = new THREE.Mesh(boxGeo13, paintMat);
  box45.position.set(-0.309, 0, 0);
  letteringL.add(box45);
  const box46 = new THREE.Mesh(boxGeo14, paintMat);
  box46.position.set(-0.2775, 0.049, 0);
  letteringL.add(box46);
  const box47 = new THREE.Mesh(boxGeo14, paintMat);
  box47.position.set(-0.2775, 0, 0);
  letteringL.add(box47);
  const box48 = new THREE.Mesh(boxGeo15, paintMat);
  box48.position.set(-0.246, 0.03, 0);
  letteringL.add(box48);
  const box49 = new THREE.Mesh(boxGeo13, paintMat);
  box49.position.set(-0.198, 0, 0);
  letteringL.add(box49);
  const box50 = new THREE.Mesh(boxGeo13, paintMat);
  box50.position.set(-0.135, 0, 0);
  letteringL.add(box50);
  const box51 = new THREE.Mesh(boxGeo14, paintMat);
  box51.position.set(-0.1665, 0.049, 0);
  letteringL.add(box51);
  const box52 = new THREE.Mesh(boxGeo14, paintMat);
  box52.position.set(-0.1665, -0.049, 0);
  letteringL.add(box52);
  const box53 = new THREE.Mesh(boxGeo13, paintMat);
  box53.position.set(-0.087, 0, 0);
  letteringL.add(box53);
  const box54 = new THREE.Mesh(boxGeo14, paintMat);
  box54.position.set(-0.0555, -0.049, 0);
  letteringL.add(box54);
  const box55 = new THREE.Mesh(boxGeo13, paintMat);
  box55.position.set(0.0555, 0, 0);
  letteringL.add(box55);
  const box56 = new THREE.Mesh(boxGeo13, paintMat);
  box56.position.set(0.135, 0, 0);
  letteringL.add(box56);
  const box57 = new THREE.Mesh(boxGeo14, paintMat);
  box57.position.set(0.1665, 0.049, 0);
  letteringL.add(box57);
  const box58 = new THREE.Mesh(boxGeo14, paintMat);
  box58.position.set(0.1665, -0.049, 0);
  letteringL.add(box58);
  const box59 = new THREE.Mesh(boxGeo13, paintMat);
  box59.position.set(0.246, 0, 0);
  letteringL.add(box59);
  const box60 = new THREE.Mesh(boxGeo14, paintMat);
  box60.position.set(0.2775, 0.049, 0);
  letteringL.add(box60);
  const box61 = new THREE.Mesh(boxGeo16, paintMat);
  box61.position.set(0.2665, 0, 0);
  letteringL.add(box61);
  const box62 = new THREE.Mesh(boxGeo14, paintMat);
  box62.position.set(0.2775, -0.049, 0);
  letteringL.add(box62);
  const doorPanelR = new THREE.Mesh(boxGeo11, panelMat);
  doorPanelR.name = 'doorPanelR';
  doorPanelR.position.set(-0.954, 0.62, -0.02);
  body.add(doorPanelR);
  const box64 = new THREE.Mesh(boxGeo12, trimMat);
  box64.position.set(-0.96, 0.62, 0.98);
  body.add(box64);
  const box65 = new THREE.Mesh(boxGeo12, trimMat);
  box65.position.set(-0.96, 0.62, -0.22);
  body.add(box65);
  const box66 = new THREE.Mesh(boxGeo12, trimMat);
  box66.position.set(-0.96, 0.62, -1);
  body.add(box66);
  const badgeR = new THREE.Mesh(extrudeGeo3, goldMat);
  badgeR.name = 'badgeR';
  badgeR.position.set(-0.964, 0.66, 0.44);
  badgeR.rotation.set(0, deg(-90), 0);
  body.add(badgeR);
  const letteringR = new THREE.Group();
  letteringR.name = 'letteringR';
  letteringR.position.set(-0.962, 0.62, -0.6);
  letteringR.rotation.set(0, deg(-90), 0);
  body.add(letteringR);
  const box69 = new THREE.Mesh(boxGeo13, paintMat);
  box69.position.set(-0.309, 0, 0);
  letteringR.add(box69);
  const box70 = new THREE.Mesh(boxGeo14, paintMat);
  box70.position.set(-0.2775, 0.049, 0);
  letteringR.add(box70);
  const box71 = new THREE.Mesh(boxGeo14, paintMat);
  box71.position.set(-0.2775, 0, 0);
  letteringR.add(box71);
  const box72 = new THREE.Mesh(boxGeo15, paintMat);
  box72.position.set(-0.246, 0.03, 0);
  letteringR.add(box72);
  const box73 = new THREE.Mesh(boxGeo13, paintMat);
  box73.position.set(-0.198, 0, 0);
  letteringR.add(box73);
  const box74 = new THREE.Mesh(boxGeo13, paintMat);
  box74.position.set(-0.135, 0, 0);
  letteringR.add(box74);
  const box75 = new THREE.Mesh(boxGeo14, paintMat);
  box75.position.set(-0.1665, 0.049, 0);
  letteringR.add(box75);
  const box76 = new THREE.Mesh(boxGeo14, paintMat);
  box76.position.set(-0.1665, -0.049, 0);
  letteringR.add(box76);
  const box77 = new THREE.Mesh(boxGeo13, paintMat);
  box77.position.set(-0.087, 0, 0);
  letteringR.add(box77);
  const box78 = new THREE.Mesh(boxGeo14, paintMat);
  box78.position.set(-0.0555, -0.049, 0);
  letteringR.add(box78);
  const box79 = new THREE.Mesh(boxGeo13, paintMat);
  box79.position.set(0.0555, 0, 0);
  letteringR.add(box79);
  const box80 = new THREE.Mesh(boxGeo13, paintMat);
  box80.position.set(0.135, 0, 0);
  letteringR.add(box80);
  const box81 = new THREE.Mesh(boxGeo14, paintMat);
  box81.position.set(0.1665, 0.049, 0);
  letteringR.add(box81);
  const box82 = new THREE.Mesh(boxGeo14, paintMat);
  box82.position.set(0.1665, -0.049, 0);
  letteringR.add(box82);
  const box83 = new THREE.Mesh(boxGeo13, paintMat);
  box83.position.set(0.246, 0, 0);
  letteringR.add(box83);
  const box84 = new THREE.Mesh(boxGeo14, paintMat);
  box84.position.set(0.2775, 0.049, 0);
  letteringR.add(box84);
  const box85 = new THREE.Mesh(boxGeo16, paintMat);
  box85.position.set(0.2665, 0, 0);
  letteringR.add(box85);
  const box86 = new THREE.Mesh(boxGeo14, paintMat);
  box86.position.set(0.2775, -0.049, 0);
  letteringR.add(box86);
  const lightbar = new THREE.Group();
  lightbar.name = 'lightbar';
  lightbar.position.set(0, 1.476, 0.02);
  body.add(lightbar);
  const box88 = new THREE.Mesh(boxGeo17, trimMat);
  box88.position.set(0.48, 0.02, 0);
  lightbar.add(box88);
  const box89 = new THREE.Mesh(boxGeo17, trimMat);
  box89.position.set(-0.48, 0.02, 0);
  lightbar.add(box89);
  const lightbarBase = new THREE.Mesh(new THREE.BoxGeometry(1.36, 0.05, 0.3), trimMat);
  lightbarBase.name = 'lightbarBase';
  lightbarBase.position.set(0, 0.06, 0);
  lightbar.add(lightbarBase);
  const lightRed = new THREE.Mesh(boxGeo18, lightRedMat);
  lightRed.name = 'lightRed';
  lightRed.position.set(0.36, 0.13, 0);
  lightbar.add(lightRed);
  const lightBlue = new THREE.Mesh(boxGeo18, lightBlueMat);
  lightBlue.name = 'lightBlue';
  lightBlue.position.set(-0.36, 0.13, 0);
  lightbar.add(lightBlue);
  const lightbarCenter = new THREE.Mesh(new THREE.BoxGeometry(0.1, 0.11, 0.27), chromeMat);
  lightbarCenter.name = 'lightbarCenter';
  lightbarCenter.position.set(0, 0.135, 0);
  lightbar.add(lightbarCenter);
  const box94 = new THREE.Mesh(boxGeo19, trimMat);
  box94.position.set(0.66, 0.135, 0);
  lightbar.add(box94);
  const box95 = new THREE.Mesh(boxGeo19, trimMat);
  box95.position.set(-0.66, 0.135, 0);
  lightbar.add(box95);
  const box96 = new THREE.Mesh(boxGeo20, trimMat);
  box96.position.set(0.36, 0.1325, 0);
  lightbar.add(box96);
  const box97 = new THREE.Mesh(boxGeo20, trimMat);
  box97.position.set(-0.36, 0.1325, 0);
  lightbar.add(box97);
  const spotlight = new THREE.Mesh(new THREE.CylinderGeometry(0.055, 0.045, 0.12, 8), chromeMat);
  spotlight.name = 'spotlight';
  spotlight.position.set(0.86, 1.13, 0.86);
  spotlight.rotation.set(deg(90), 0, 0);
  body.add(spotlight);
  const cylinder99 = new THREE.Mesh(new THREE.CylinderGeometry(0.04, 0.04, 0.01, 8), headlightMat);
  cylinder99.position.set(0.86, 1.13, 0.925);
  cylinder99.rotation.set(deg(90), 0, 0);
  body.add(cylinder99);
  const cylinder100 = new THREE.Mesh(new THREE.CylinderGeometry(0.012, 0.012, 0.12, 5), trimMat);
  cylinder100.position.set(0.86, 1.04, 0.86);
  body.add(cylinder100);
  const antenna = new THREE.Mesh(new THREE.CylinderGeometry(0.004, 0.006, 0.55, 4), trimMat);
  antenna.name = 'antenna';
  antenna.position.set(0.3, 1.265, -2);
  antenna.rotation.set(deg(-8), 0, 0);
  body.add(antenna);
  const pushBar = new THREE.Group();
  pushBar.name = 'pushBar';
  body.add(pushBar);
  const box103 = new THREE.Mesh(boxGeo21, trimMat);
  box103.position.set(0.36, 0.52, 2.66);
  pushBar.add(box103);
  const box104 = new THREE.Mesh(boxGeo22, trimMat);
  box104.position.set(0.36, 0.38, 2.55);
  pushBar.add(box104);
  const box105 = new THREE.Mesh(boxGeo21, trimMat);
  box105.position.set(-0.36, 0.52, 2.66);
  pushBar.add(box105);
  const box106 = new THREE.Mesh(boxGeo22, trimMat);
  box106.position.set(-0.36, 0.38, 2.55);
  pushBar.add(box106);
  const pushBarTop = new THREE.Mesh(boxGeo23, trimMat);
  pushBarTop.name = 'pushBarTop';
  pushBarTop.position.set(0, 0.76, 2.67);
  pushBar.add(pushBarTop);
  const box108 = new THREE.Mesh(boxGeo23, trimMat);
  box108.position.set(0, 0.5, 2.67);
  pushBar.add(box108);
  const grilleLightRed = new THREE.Mesh(boxGeo24, lightRedMat);
  grilleLightRed.name = 'grilleLightRed';
  grilleLightRed.position.set(0.22, 0.625, 2.69);
  pushBar.add(grilleLightRed);
  const grilleLightBlue = new THREE.Mesh(boxGeo24, lightBlueMat);
  grilleLightBlue.name = 'grilleLightBlue';
  grilleLightBlue.position.set(-0.22, 0.625, 2.69);
  pushBar.add(grilleLightBlue);
  const wheels = new THREE.Group();
  wheels.name = 'wheels';
  root.add(wheels);
  const wheelFL = new THREE.Group();
  wheelFL.name = 'wheelFL';
  wheelFL.position.set(0.8, 0.36, 1.45);
  wheels.add(wheelFL);
  const tire = new THREE.Mesh(latheGeo, trimMat);
  tire.name = 'tire';
  tire.rotation.set(0, 0, deg(90));
  wheelFL.add(tire);
  const rim = new THREE.Mesh(cylinderGeo, trimMat);
  rim.name = 'rim';
  rim.rotation.set(0, 0, deg(90));
  wheelFL.add(rim);
  const wheelDisc = new THREE.Mesh(cylinderGeo2, trimMat);
  wheelDisc.name = 'wheelDisc';
  wheelDisc.position.set(0.107, 0, 0);
  wheelDisc.rotation.set(0, 0, deg(-90));
  wheelFL.add(wheelDisc);
  const centerCap = new THREE.Mesh(cylinderGeo3, chromeMat);
  centerCap.name = 'centerCap';
  centerCap.position.set(0.125, 0, 0);
  centerCap.rotation.set(0, 0, deg(-90));
  wheelFL.add(centerCap);
  const wheelFR = new THREE.Group();
  wheelFR.name = 'wheelFR';
  wheelFR.position.set(-0.8, 0.36, 1.45);
  wheels.add(wheelFR);
  const tire2 = new THREE.Mesh(latheGeo, trimMat);
  tire2.name = 'tire';
  tire2.rotation.set(0, 0, deg(90));
  wheelFR.add(tire2);
  const rim2 = new THREE.Mesh(cylinderGeo, trimMat);
  rim2.name = 'rim';
  rim2.rotation.set(0, 0, deg(90));
  wheelFR.add(rim2);
  const wheelDisc2 = new THREE.Mesh(cylinderGeo2, trimMat);
  wheelDisc2.name = 'wheelDisc';
  wheelDisc2.position.set(-0.107, 0, 0);
  wheelDisc2.rotation.set(0, 0, deg(90));
  wheelFR.add(wheelDisc2);
  const centerCap2 = new THREE.Mesh(cylinderGeo3, chromeMat);
  centerCap2.name = 'centerCap';
  centerCap2.position.set(-0.125, 0, 0);
  centerCap2.rotation.set(0, 0, deg(90));
  wheelFR.add(centerCap2);
  const wheelRL = new THREE.Group();
  wheelRL.name = 'wheelRL';
  wheelRL.position.set(0.8, 0.36, -1.45);
  wheels.add(wheelRL);
  const tire3 = new THREE.Mesh(latheGeo, trimMat);
  tire3.name = 'tire';
  tire3.rotation.set(0, 0, deg(90));
  wheelRL.add(tire3);
  const rim3 = new THREE.Mesh(cylinderGeo, trimMat);
  rim3.name = 'rim';
  rim3.rotation.set(0, 0, deg(90));
  wheelRL.add(rim3);
  const wheelDisc3 = new THREE.Mesh(cylinderGeo2, trimMat);
  wheelDisc3.name = 'wheelDisc';
  wheelDisc3.position.set(0.107, 0, 0);
  wheelDisc3.rotation.set(0, 0, deg(-90));
  wheelRL.add(wheelDisc3);
  const centerCap3 = new THREE.Mesh(cylinderGeo3, chromeMat);
  centerCap3.name = 'centerCap';
  centerCap3.position.set(0.125, 0, 0);
  centerCap3.rotation.set(0, 0, deg(-90));
  wheelRL.add(centerCap3);
  const wheelRR = new THREE.Group();
  wheelRR.name = 'wheelRR';
  wheelRR.position.set(-0.8, 0.36, -1.45);
  wheels.add(wheelRR);
  const tire4 = new THREE.Mesh(latheGeo, trimMat);
  tire4.name = 'tire';
  tire4.rotation.set(0, 0, deg(90));
  wheelRR.add(tire4);
  const rim4 = new THREE.Mesh(cylinderGeo, trimMat);
  rim4.name = 'rim';
  rim4.rotation.set(0, 0, deg(90));
  wheelRR.add(rim4);
  const wheelDisc4 = new THREE.Mesh(cylinderGeo2, trimMat);
  wheelDisc4.name = 'wheelDisc';
  wheelDisc4.position.set(-0.107, 0, 0);
  wheelDisc4.rotation.set(0, 0, deg(90));
  wheelRR.add(wheelDisc4);
  const centerCap4 = new THREE.Mesh(cylinderGeo3, chromeMat);
  centerCap4.name = 'centerCap';
  centerCap4.position.set(-0.125, 0, 0);
  centerCap4.rotation.set(0, 0, deg(90));
  wheelRR.add(centerCap4);

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

export default createPoliceCar;

Puanlar ve yorumlar

—
Henüz puan yok — ilk puanı sen ver.
5
0
4
0
3
0
2
0
1
0

Puan vermek ve yorum yapmak için giriş yap.

0 yorum

Henüz yorum yok. Bu modeli nasıl kullandığını ya da neyin daha iyi olabileceğini paylaş.

Benzer modeller

Aynı kategori ya da benzer etiketler