3484 ポリゴン2.42 × 2.72 × 3.96 m
コードで使う
エディターでリミックスtractor.js · 688 行
自己完結型の ES モジュールで、依存先は three のみです。ファクトリー関数を呼び出し、返された group をシーンに追加してください。
/**
* Farm Tractor — Codels 3D model library
* License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
* Triangles: 3,484 · Size (W × H × D): 2.42 × 2.72 × 3.96 m
*
* Usage:
* import { createTractor } from './tractor.js';
*
* const model = createTractor();
* 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 createTractor() {
const root = new THREE.Group();
root.name = 'Tractor';
// Materials
const paintMat = new THREE.MeshStandardMaterial({ name: 'paint', color: 0x3f8b3a, roughness: 0.5, metalness: 0.1, flatShading: true });
const rimMat = new THREE.MeshStandardMaterial({ name: 'rim', color: 0xf2c21b, roughness: 0.5, metalness: 0.15, flatShading: true });
const tireMat = new THREE.MeshStandardMaterial({ name: 'tire', color: 0x26272a, roughness: 0.9, flatShading: true });
const trimMat = new THREE.MeshStandardMaterial({ name: 'trim', color: 0x34363b, roughness: 0.75, flatShading: true });
const metalMat = new THREE.MeshStandardMaterial({ name: 'metal', color: 0x8d9298, roughness: 0.4, metalness: 0.6, flatShading: true });
const glassMat = new THREE.MeshStandardMaterial({ name: 'glass', color: 0x2a3644, roughness: 0.2, metalness: 0.3, flatShading: true });
const seatMat = new THREE.MeshStandardMaterial({ name: 'seat', color: 0xe4e2da, roughness: 0.7, 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 });
// Shared geometries
const latheGeo = lathe([[0.22, -0.08], [0.22, -0.12], [0.363, -0.12], [0.4, -0.0672], [0.4, -0.07], [0.418, -0.04], [0.418, 0.04], [0.4, 0.07], [0.4, 0.0672], [0.363, 0.12], [0.22, 0.12], [0.22, 0.08]], 12);
const cylinderGeo = new THREE.CylinderGeometry(0.22, 0.22, 0.16, 14);
const cylinderGeo2 = new THREE.CylinderGeometry(0.121, 0.187, 0.05, 12);
const cylinderGeo3 = new THREE.CylinderGeometry(0.0484, 0.066, 0.12, 8);
const latheGeo2 = lathe([[0.4144, -0.19], [0.4144, -0.23], [0.67, -0.23], [0.74, -0.13], [0.74, 0.13], [0.67, 0.23], [0.4144, 0.23], [0.4144, 0.19]], 16);
const cylinderGeo4 = new THREE.CylinderGeometry(0.4144, 0.4144, 0.38, 14);
const cylinderGeo5 = new THREE.CylinderGeometry(0.2279, 0.3522, 0.05, 12);
const cylinderGeo6 = new THREE.CylinderGeometry(0.0912, 0.1243, 0.12, 8);
const boxGeo = new THREE.BoxGeometry(0.2495, 0.08, 0.075);
const boxGeo2 = new THREE.BoxGeometry(0.56, 0.025, 0.02);
const boxGeo3 = new THREE.BoxGeometry(0.03, 0.1, 1.3);
const boxGeo4 = new THREE.BoxGeometry(0.12, 0.09, 0.05);
const boxGeo5 = new THREE.BoxGeometry(0.16, 0.36, 0.18);
const cylinderGeo7 = new THREE.CylinderGeometry(0.11, 0.13, 0.4, 8);
const extrudeGeo = extrude([[0.8716, 0.3521], [0.7507, 0.5657], [0.5787, 0.7407], [0.3673, 0.8653], [0.1308, 0.9309], [-0.1146, 0.933], [-0.3521, 0.8716], [-0.5657, 0.7507], [-0.7407, 0.5787], [-0.8653, 0.3673], [-0.9309, 0.1308], [-0.8813, 0.1239], [-0.8192, 0.3478], [-0.7013, 0.5479], [-0.5356, 0.7108], [-0.3334, 0.8252], [-0.1085, 0.8834], [0.1239, 0.8813], [0.3478, 0.8192], [0.5479, 0.7013], [0.7108, 0.5356], [0.8252, 0.3334]], 0.52);
const boxGeo6 = new THREE.BoxGeometry(0.1, 0.07, 0.04);
const boxGeo7 = new THREE.BoxGeometry(0.08, 0.6, 0.06);
const boxGeo8 = new THREE.BoxGeometry(0.26, 0.04, 0.22);
const boxGeo9 = new THREE.BoxGeometry(0.04, 0.5, 0.04);
const boxGeo10 = new THREE.BoxGeometry(0.07, 1.42, 0.07);
const boxGeo11 = new THREE.BoxGeometry(0.1, 0.08, 0.06);
const boxGeo12 = new THREE.BoxGeometry(0.12, 0.06, 0.02);
const boxGeo13 = new THREE.BoxGeometry(1.18, 1.37, 0.02);
const boxGeo14 = new THREE.BoxGeometry(0.02, 1.37, 1.22);
const boxGeo15 = new THREE.BoxGeometry(0.04, 0.03, 0.12);
const cylinderGeo8 = new THREE.CylinderGeometry(0.035, 0.035, 0.5071, 6);
// Parts
const wheels = new THREE.Group();
wheels.name = 'wheels';
root.add(wheels);
const wheelFL = new THREE.Group();
wheelFL.name = 'wheelFL';
wheelFL.position.set(0.7, 0.418, 1.35);
wheels.add(wheelFL);
const tire = new THREE.Mesh(latheGeo, tireMat);
tire.name = 'tire';
tire.rotation.set(0, 0, deg(90));
wheelFL.add(tire);
const rim = new THREE.Mesh(cylinderGeo, rimMat);
rim.name = 'rim';
rim.rotation.set(0, 0, deg(90));
wheelFL.add(rim);
const disc = new THREE.Mesh(cylinderGeo2, rimMat);
disc.name = 'disc';
disc.position.set(0.02, 0, 0);
disc.rotation.set(0, 0, deg(-90));
wheelFL.add(disc);
const hub = new THREE.Mesh(cylinderGeo3, metalMat);
hub.name = 'hub';
hub.position.set(0.06, 0, 0);
hub.rotation.set(0, 0, deg(-90));
wheelFL.add(hub);
const wheelFR = new THREE.Group();
wheelFR.name = 'wheelFR';
wheelFR.position.set(-0.7, 0.418, 1.35);
wheels.add(wheelFR);
const tire2 = new THREE.Mesh(latheGeo, tireMat);
tire2.name = 'tire';
tire2.rotation.set(0, 0, deg(90));
wheelFR.add(tire2);
const rim2 = new THREE.Mesh(cylinderGeo, rimMat);
rim2.name = 'rim';
rim2.rotation.set(0, 0, deg(90));
wheelFR.add(rim2);
const disc2 = new THREE.Mesh(cylinderGeo2, rimMat);
disc2.name = 'disc';
disc2.position.set(-0.02, 0, 0);
disc2.rotation.set(0, 0, deg(90));
wheelFR.add(disc2);
const hub2 = new THREE.Mesh(cylinderGeo3, metalMat);
hub2.name = 'hub';
hub2.position.set(-0.06, 0, 0);
hub2.rotation.set(0, 0, deg(90));
wheelFR.add(hub2);
const wheelRL = new THREE.Group();
wheelRL.name = 'wheelRL';
wheelRL.position.set(0.95, 0.8059, -0.75);
wheels.add(wheelRL);
const tire3 = new THREE.Mesh(latheGeo2, tireMat);
tire3.name = 'tire';
tire3.rotation.set(0, 0, deg(90));
wheelRL.add(tire3);
const rim3 = new THREE.Mesh(cylinderGeo4, rimMat);
rim3.name = 'rim';
rim3.rotation.set(0, 0, deg(90));
wheelRL.add(rim3);
const disc3 = new THREE.Mesh(cylinderGeo5, rimMat);
disc3.name = 'disc';
disc3.position.set(0.13, 0, 0);
disc3.rotation.set(0, 0, deg(-90));
wheelRL.add(disc3);
const hub3 = new THREE.Mesh(cylinderGeo6, metalMat);
hub3.name = 'hub';
hub3.position.set(0.17, 0, 0);
hub3.rotation.set(0, 0, deg(-90));
wheelRL.add(hub3);
const box17 = new THREE.Mesh(boxGeo, tireMat);
box17.position.set(0.1228, -0.76, 0.0767);
box17.rotation.set(deg(180), deg(32), 0);
wheelRL.add(box17);
const box18 = new THREE.Mesh(boxGeo, tireMat);
box18.position.set(-0.1228, -0.76, 0.0767);
box18.rotation.set(0, deg(32), deg(-180));
wheelRL.add(box18);
const box19 = new THREE.Mesh(boxGeo, tireMat);
box19.position.set(0.1228, -0.6728, 0.3617);
box19.rotation.set(deg(157.5), deg(32), 0);
wheelRL.add(box19);
const box20 = new THREE.Mesh(boxGeo, tireMat);
box20.position.set(-0.1228, -0.6728, 0.3617);
box20.rotation.set(deg(-22.5), deg(32), deg(-180));
wheelRL.add(box20);
const box21 = new THREE.Mesh(boxGeo, tireMat);
box21.position.set(0.1228, -0.4832, 0.5916);
box21.rotation.set(deg(135), deg(32), 0);
wheelRL.add(box21);
const box22 = new THREE.Mesh(boxGeo, tireMat);
box22.position.set(-0.1228, -0.4832, 0.5916);
box22.rotation.set(deg(-45), deg(32), deg(180));
wheelRL.add(box22);
const box23 = new THREE.Mesh(boxGeo, tireMat);
box23.position.set(0.1228, -0.22, 0.7315);
box23.rotation.set(deg(112.5), deg(32), 0);
wheelRL.add(box23);
const box24 = new THREE.Mesh(boxGeo, tireMat);
box24.position.set(-0.1228, -0.22, 0.7315);
box24.rotation.set(deg(-67.5), deg(32), deg(180));
wheelRL.add(box24);
const box25 = new THREE.Mesh(boxGeo, tireMat);
box25.position.set(0.1228, 0.0767, 0.76);
box25.rotation.set(deg(90), deg(32), 0);
wheelRL.add(box25);
const box26 = new THREE.Mesh(boxGeo, tireMat);
box26.position.set(-0.1228, 0.0767, 0.76);
box26.rotation.set(deg(-90), deg(32), deg(-180));
wheelRL.add(box26);
const box27 = new THREE.Mesh(boxGeo, tireMat);
box27.position.set(0.1228, 0.3617, 0.6728);
box27.rotation.set(deg(67.5), deg(32), 0);
wheelRL.add(box27);
const box28 = new THREE.Mesh(boxGeo, tireMat);
box28.position.set(-0.1228, 0.3617, 0.6728);
box28.rotation.set(deg(-112.5), deg(32), deg(-180));
wheelRL.add(box28);
const box29 = new THREE.Mesh(boxGeo, tireMat);
box29.position.set(0.1228, 0.5916, 0.4832);
box29.rotation.set(deg(45), deg(32), 0);
wheelRL.add(box29);
const box30 = new THREE.Mesh(boxGeo, tireMat);
box30.position.set(-0.1228, 0.5916, 0.4832);
box30.rotation.set(deg(-135), deg(32), deg(-180));
wheelRL.add(box30);
const box31 = new THREE.Mesh(boxGeo, tireMat);
box31.position.set(0.1228, 0.7315, 0.22);
box31.rotation.set(deg(22.5), deg(32), 0);
wheelRL.add(box31);
const box32 = new THREE.Mesh(boxGeo, tireMat);
box32.position.set(-0.1228, 0.7315, 0.22);
box32.rotation.set(deg(-157.5), deg(32), deg(180));
wheelRL.add(box32);
const box33 = new THREE.Mesh(boxGeo, tireMat);
box33.position.set(0.1228, 0.76, -0.0767);
box33.rotation.set(0, deg(32), 0);
wheelRL.add(box33);
const box34 = new THREE.Mesh(boxGeo, tireMat);
box34.position.set(-0.1228, 0.76, -0.0767);
box34.rotation.set(deg(-180), deg(32), deg(-180));
wheelRL.add(box34);
const box35 = new THREE.Mesh(boxGeo, tireMat);
box35.position.set(0.1228, 0.6728, -0.3617);
box35.rotation.set(deg(-22.5), deg(32), 0);
wheelRL.add(box35);
const box36 = new THREE.Mesh(boxGeo, tireMat);
box36.position.set(-0.1228, 0.6728, -0.3617);
box36.rotation.set(deg(157.5), deg(32), deg(-180));
wheelRL.add(box36);
const box37 = new THREE.Mesh(boxGeo, tireMat);
box37.position.set(0.1228, 0.4832, -0.5916);
box37.rotation.set(deg(-45), deg(32), 0);
wheelRL.add(box37);
const box38 = new THREE.Mesh(boxGeo, tireMat);
box38.position.set(-0.1228, 0.4832, -0.5916);
box38.rotation.set(deg(135), deg(32), deg(180));
wheelRL.add(box38);
const box39 = new THREE.Mesh(boxGeo, tireMat);
box39.position.set(0.1228, 0.22, -0.7315);
box39.rotation.set(deg(-67.5), deg(32), 0);
wheelRL.add(box39);
const box40 = new THREE.Mesh(boxGeo, tireMat);
box40.position.set(-0.1228, 0.22, -0.7315);
box40.rotation.set(deg(112.5), deg(32), deg(-180));
wheelRL.add(box40);
const box41 = new THREE.Mesh(boxGeo, tireMat);
box41.position.set(0.1228, -0.0767, -0.76);
box41.rotation.set(deg(-90), deg(32), 0);
wheelRL.add(box41);
const box42 = new THREE.Mesh(boxGeo, tireMat);
box42.position.set(-0.1228, -0.0767, -0.76);
box42.rotation.set(deg(90), deg(32), deg(-180));
wheelRL.add(box42);
const box43 = new THREE.Mesh(boxGeo, tireMat);
box43.position.set(0.1228, -0.3617, -0.6728);
box43.rotation.set(deg(-112.5), deg(32), 0);
wheelRL.add(box43);
const box44 = new THREE.Mesh(boxGeo, tireMat);
box44.position.set(-0.1228, -0.3617, -0.6728);
box44.rotation.set(deg(67.5), deg(32), deg(-180));
wheelRL.add(box44);
const box45 = new THREE.Mesh(boxGeo, tireMat);
box45.position.set(0.1228, -0.5916, -0.4832);
box45.rotation.set(deg(-135), deg(32), 0);
wheelRL.add(box45);
const box46 = new THREE.Mesh(boxGeo, tireMat);
box46.position.set(-0.1228, -0.5916, -0.4832);
box46.rotation.set(deg(45), deg(32), deg(-180));
wheelRL.add(box46);
const box47 = new THREE.Mesh(boxGeo, tireMat);
box47.position.set(0.1228, -0.7315, -0.22);
box47.rotation.set(deg(-157.5), deg(32), 0);
wheelRL.add(box47);
const box48 = new THREE.Mesh(boxGeo, tireMat);
box48.position.set(-0.1228, -0.7315, -0.22);
box48.rotation.set(deg(22.5), deg(32), deg(-180));
wheelRL.add(box48);
const wheelRR = new THREE.Group();
wheelRR.name = 'wheelRR';
wheelRR.position.set(-0.95, 0.8059, -0.75);
wheels.add(wheelRR);
const tire4 = new THREE.Mesh(latheGeo2, tireMat);
tire4.name = 'tire';
tire4.rotation.set(0, 0, deg(90));
wheelRR.add(tire4);
const rim4 = new THREE.Mesh(cylinderGeo4, rimMat);
rim4.name = 'rim';
rim4.rotation.set(0, 0, deg(90));
wheelRR.add(rim4);
const disc4 = new THREE.Mesh(cylinderGeo5, rimMat);
disc4.name = 'disc';
disc4.position.set(-0.13, 0, 0);
disc4.rotation.set(0, 0, deg(90));
wheelRR.add(disc4);
const hub4 = new THREE.Mesh(cylinderGeo6, metalMat);
hub4.name = 'hub';
hub4.position.set(-0.17, 0, 0);
hub4.rotation.set(0, 0, deg(90));
wheelRR.add(hub4);
const box54 = new THREE.Mesh(boxGeo, tireMat);
box54.position.set(0.1228, -0.76, 0.0767);
box54.rotation.set(deg(180), deg(32), 0);
wheelRR.add(box54);
const box55 = new THREE.Mesh(boxGeo, tireMat);
box55.position.set(-0.1228, -0.76, 0.0767);
box55.rotation.set(0, deg(32), deg(-180));
wheelRR.add(box55);
const box56 = new THREE.Mesh(boxGeo, tireMat);
box56.position.set(0.1228, -0.6728, 0.3617);
box56.rotation.set(deg(157.5), deg(32), 0);
wheelRR.add(box56);
const box57 = new THREE.Mesh(boxGeo, tireMat);
box57.position.set(-0.1228, -0.6728, 0.3617);
box57.rotation.set(deg(-22.5), deg(32), deg(-180));
wheelRR.add(box57);
const box58 = new THREE.Mesh(boxGeo, tireMat);
box58.position.set(0.1228, -0.4832, 0.5916);
box58.rotation.set(deg(135), deg(32), 0);
wheelRR.add(box58);
const box59 = new THREE.Mesh(boxGeo, tireMat);
box59.position.set(-0.1228, -0.4832, 0.5916);
box59.rotation.set(deg(-45), deg(32), deg(180));
wheelRR.add(box59);
const box60 = new THREE.Mesh(boxGeo, tireMat);
box60.position.set(0.1228, -0.22, 0.7315);
box60.rotation.set(deg(112.5), deg(32), 0);
wheelRR.add(box60);
const box61 = new THREE.Mesh(boxGeo, tireMat);
box61.position.set(-0.1228, -0.22, 0.7315);
box61.rotation.set(deg(-67.5), deg(32), deg(180));
wheelRR.add(box61);
const box62 = new THREE.Mesh(boxGeo, tireMat);
box62.position.set(0.1228, 0.0767, 0.76);
box62.rotation.set(deg(90), deg(32), 0);
wheelRR.add(box62);
const box63 = new THREE.Mesh(boxGeo, tireMat);
box63.position.set(-0.1228, 0.0767, 0.76);
box63.rotation.set(deg(-90), deg(32), deg(-180));
wheelRR.add(box63);
const box64 = new THREE.Mesh(boxGeo, tireMat);
box64.position.set(0.1228, 0.3617, 0.6728);
box64.rotation.set(deg(67.5), deg(32), 0);
wheelRR.add(box64);
const box65 = new THREE.Mesh(boxGeo, tireMat);
box65.position.set(-0.1228, 0.3617, 0.6728);
box65.rotation.set(deg(-112.5), deg(32), deg(-180));
wheelRR.add(box65);
const box66 = new THREE.Mesh(boxGeo, tireMat);
box66.position.set(0.1228, 0.5916, 0.4832);
box66.rotation.set(deg(45), deg(32), 0);
wheelRR.add(box66);
const box67 = new THREE.Mesh(boxGeo, tireMat);
box67.position.set(-0.1228, 0.5916, 0.4832);
box67.rotation.set(deg(-135), deg(32), deg(-180));
wheelRR.add(box67);
const box68 = new THREE.Mesh(boxGeo, tireMat);
box68.position.set(0.1228, 0.7315, 0.22);
box68.rotation.set(deg(22.5), deg(32), 0);
wheelRR.add(box68);
const box69 = new THREE.Mesh(boxGeo, tireMat);
box69.position.set(-0.1228, 0.7315, 0.22);
box69.rotation.set(deg(-157.5), deg(32), deg(180));
wheelRR.add(box69);
const box70 = new THREE.Mesh(boxGeo, tireMat);
box70.position.set(0.1228, 0.76, -0.0767);
box70.rotation.set(0, deg(32), 0);
wheelRR.add(box70);
const box71 = new THREE.Mesh(boxGeo, tireMat);
box71.position.set(-0.1228, 0.76, -0.0767);
box71.rotation.set(deg(-180), deg(32), deg(-180));
wheelRR.add(box71);
const box72 = new THREE.Mesh(boxGeo, tireMat);
box72.position.set(0.1228, 0.6728, -0.3617);
box72.rotation.set(deg(-22.5), deg(32), 0);
wheelRR.add(box72);
const box73 = new THREE.Mesh(boxGeo, tireMat);
box73.position.set(-0.1228, 0.6728, -0.3617);
box73.rotation.set(deg(157.5), deg(32), deg(-180));
wheelRR.add(box73);
const box74 = new THREE.Mesh(boxGeo, tireMat);
box74.position.set(0.1228, 0.4832, -0.5916);
box74.rotation.set(deg(-45), deg(32), 0);
wheelRR.add(box74);
const box75 = new THREE.Mesh(boxGeo, tireMat);
box75.position.set(-0.1228, 0.4832, -0.5916);
box75.rotation.set(deg(135), deg(32), deg(180));
wheelRR.add(box75);
const box76 = new THREE.Mesh(boxGeo, tireMat);
box76.position.set(0.1228, 0.22, -0.7315);
box76.rotation.set(deg(-67.5), deg(32), 0);
wheelRR.add(box76);
const box77 = new THREE.Mesh(boxGeo, tireMat);
box77.position.set(-0.1228, 0.22, -0.7315);
box77.rotation.set(deg(112.5), deg(32), deg(-180));
wheelRR.add(box77);
const box78 = new THREE.Mesh(boxGeo, tireMat);
box78.position.set(0.1228, -0.0767, -0.76);
box78.rotation.set(deg(-90), deg(32), 0);
wheelRR.add(box78);
const box79 = new THREE.Mesh(boxGeo, tireMat);
box79.position.set(-0.1228, -0.0767, -0.76);
box79.rotation.set(deg(90), deg(32), deg(-180));
wheelRR.add(box79);
const box80 = new THREE.Mesh(boxGeo, tireMat);
box80.position.set(0.1228, -0.3617, -0.6728);
box80.rotation.set(deg(-112.5), deg(32), 0);
wheelRR.add(box80);
const box81 = new THREE.Mesh(boxGeo, tireMat);
box81.position.set(-0.1228, -0.3617, -0.6728);
box81.rotation.set(deg(67.5), deg(32), deg(-180));
wheelRR.add(box81);
const box82 = new THREE.Mesh(boxGeo, tireMat);
box82.position.set(0.1228, -0.5916, -0.4832);
box82.rotation.set(deg(-135), deg(32), 0);
wheelRR.add(box82);
const box83 = new THREE.Mesh(boxGeo, tireMat);
box83.position.set(-0.1228, -0.5916, -0.4832);
box83.rotation.set(deg(45), deg(32), deg(-180));
wheelRR.add(box83);
const box84 = new THREE.Mesh(boxGeo, tireMat);
box84.position.set(0.1228, -0.7315, -0.22);
box84.rotation.set(deg(-157.5), deg(32), 0);
wheelRR.add(box84);
const box85 = new THREE.Mesh(boxGeo, tireMat);
box85.position.set(-0.1228, -0.7315, -0.22);
box85.rotation.set(deg(22.5), deg(32), deg(-180));
wheelRR.add(box85);
const body = new THREE.Group();
body.name = 'body';
root.add(body);
const hood = new THREE.Mesh(extrude([[-0.05, 0.82], [-0.05, 1.46], [1.55, 1.44], [1.84, 1.3], [1.86, 0.82]], 0.66, [], [0.03, 0.03, 1]), paintMat);
hood.name = 'hood';
hood.rotation.set(0, deg(-90), 0);
body.add(hood);
const grille = new THREE.Mesh(new THREE.BoxGeometry(0.62, 0.38, 0.03), trimMat);
grille.name = 'grille';
grille.position.set(0, 1.03, 1.9);
body.add(grille);
const box89 = new THREE.Mesh(boxGeo2, metalMat);
box89.position.set(0, 0.89, 1.915);
body.add(box89);
const box90 = new THREE.Mesh(boxGeo2, metalMat);
box90.position.set(0, 0.98, 1.915);
body.add(box90);
const box91 = new THREE.Mesh(boxGeo2, metalMat);
box91.position.set(0, 1.07, 1.915);
body.add(box91);
const box92 = new THREE.Mesh(boxGeo2, metalMat);
box92.position.set(0, 1.16, 1.915);
body.add(box92);
const ventL = new THREE.Mesh(boxGeo3, trimMat);
ventL.name = 'ventL';
ventL.position.set(0.37, 1.32, 0.85);
body.add(ventL);
const headlightL = new THREE.Mesh(boxGeo4, headlightMat);
headlightL.name = 'headlightL';
headlightL.position.set(0.26, 1.33, 1.86);
body.add(headlightL);
const ventR = new THREE.Mesh(boxGeo3, trimMat);
ventR.name = 'ventR';
ventR.position.set(-0.37, 1.32, 0.85);
body.add(ventR);
const headlightR = new THREE.Mesh(boxGeo4, headlightMat);
headlightR.name = 'headlightR';
headlightR.position.set(-0.26, 1.33, 1.86);
body.add(headlightR);
const engine = new THREE.Mesh(new THREE.BoxGeometry(0.5, 0.26, 1.7), trimMat);
engine.name = 'engine';
engine.position.set(0, 0.7, 0.95);
body.add(engine);
const axlePivot = new THREE.Mesh(new THREE.BoxGeometry(0.22, 0.2, 0.3), trimMat);
axlePivot.name = 'axlePivot';
axlePivot.position.set(0, 0.55, 1.35);
body.add(axlePivot);
const frontAxle = new THREE.Mesh(new THREE.BoxGeometry(1.22, 0.1, 0.12), trimMat);
frontAxle.name = 'frontAxle';
frontAxle.position.set(0, 0.418, 1.35);
body.add(frontAxle);
const weightBracket = new THREE.Mesh(new THREE.BoxGeometry(0.3, 0.22, 0.2), trimMat);
weightBracket.name = 'weightBracket';
weightBracket.position.set(0, 0.66, 2);
body.add(weightBracket);
const weight1 = new THREE.Mesh(boxGeo5, paintMat);
weight1.name = 'weight1';
weight1.position.set(-0.34, 0.82, 2.12);
body.add(weight1);
const weight2 = new THREE.Mesh(boxGeo5, paintMat);
weight2.name = 'weight2';
weight2.position.set(-0.17, 0.82, 2.12);
body.add(weight2);
const weight3 = new THREE.Mesh(boxGeo5, paintMat);
weight3.name = 'weight3';
weight3.position.set(0, 0.82, 2.12);
body.add(weight3);
const weight4 = new THREE.Mesh(boxGeo5, paintMat);
weight4.name = 'weight4';
weight4.position.set(0.17, 0.82, 2.12);
body.add(weight4);
const weight5 = new THREE.Mesh(boxGeo5, paintMat);
weight5.name = 'weight5';
weight5.position.set(0.34, 0.82, 2.12);
body.add(weight5);
const box106 = new THREE.Mesh(new THREE.BoxGeometry(0.9, 0.06, 0.08), trimMat);
box106.position.set(0, 1.02, 2.12);
body.add(box106);
const transmission = new THREE.Mesh(new THREE.BoxGeometry(0.8, 0.6, 1.1), paintMat);
transmission.name = 'transmission';
transmission.position.set(0, 0.8059, -0.75);
body.add(transmission);
const cylinder108 = new THREE.Mesh(cylinderGeo7, trimMat);
cylinder108.position.set(0.58, 0.8059, -0.75);
cylinder108.rotation.set(0, 0, deg(90));
body.add(cylinder108);
const cylinder109 = new THREE.Mesh(cylinderGeo7, trimMat);
cylinder109.position.set(-0.58, 0.8059, -0.75);
cylinder109.rotation.set(0, 0, deg(90));
body.add(cylinder109);
const platform = new THREE.Mesh(new THREE.BoxGeometry(1.3, 0.08, 1.4), trimMat);
platform.name = 'platform';
platform.position.set(0, 1.12, -0.6);
body.add(platform);
const fenderL = new THREE.Mesh(extrudeGeo, paintMat);
fenderL.name = 'fenderL';
fenderL.position.set(0.95, 0.8059, -0.75);
fenderL.rotation.set(0, deg(-90), 0);
body.add(fenderL);
const taillightL = new THREE.Mesh(boxGeo6, taillightMat);
taillightL.name = 'taillightL';
taillightL.position.set(1.07, 0.9859, -1.7);
body.add(taillightL);
const box113 = new THREE.Mesh(boxGeo7, trimMat);
box113.position.set(0.66, 1.1259, -0.75);
body.add(box113);
const box114 = new THREE.Mesh(boxGeo8, metalMat);
box114.position.set(0.7, 0.62, 0.2);
body.add(box114);
const box115 = new THREE.Mesh(boxGeo8, metalMat);
box115.position.set(0.7, 0.9, 0.12);
body.add(box115);
const box116 = new THREE.Mesh(boxGeo9, trimMat);
box116.position.set(0.82, 0.86, 0.16);
body.add(box116);
const fenderR = new THREE.Mesh(extrudeGeo, paintMat);
fenderR.name = 'fenderR';
fenderR.position.set(-0.95, 0.8059, -0.75);
fenderR.rotation.set(0, deg(-90), 0);
body.add(fenderR);
const taillightR = new THREE.Mesh(boxGeo6, taillightMat);
taillightR.name = 'taillightR';
taillightR.position.set(-1.07, 0.9859, -1.7);
body.add(taillightR);
const box119 = new THREE.Mesh(boxGeo7, trimMat);
box119.position.set(-0.66, 1.1259, -0.75);
body.add(box119);
const box120 = new THREE.Mesh(boxGeo8, metalMat);
box120.position.set(-0.7, 0.62, 0.2);
body.add(box120);
const box121 = new THREE.Mesh(boxGeo8, metalMat);
box121.position.set(-0.7, 0.9, 0.12);
body.add(box121);
const box122 = new THREE.Mesh(boxGeo9, trimMat);
box122.position.set(-0.82, 0.86, 0.16);
body.add(box122);
const box123 = new THREE.Mesh(boxGeo10, trimMat);
box123.position.set(0.62, 1.87, -1.3);
body.add(box123);
const box124 = new THREE.Mesh(boxGeo10, trimMat);
box124.position.set(0.62, 1.87, -0.02);
body.add(box124);
const box125 = new THREE.Mesh(boxGeo10, trimMat);
box125.position.set(-0.62, 1.87, -1.3);
body.add(box125);
const box126 = new THREE.Mesh(boxGeo10, trimMat);
box126.position.set(-0.62, 1.87, -0.02);
body.add(box126);
const roof = new THREE.Mesh(new THREE.BoxGeometry(1.54, 0.1, 1.64), paintMat);
roof.name = 'roof';
roof.position.set(0, 2.63, -0.66);
body.add(roof);
const roofTop = new THREE.Mesh(new THREE.BoxGeometry(1.34, 0.04, 1.44), seatMat);
roofTop.name = 'roofTop';
roofTop.position.set(0, 2.7, -0.66);
body.add(roofTop);
const box129 = new THREE.Mesh(boxGeo11, trimMat);
box129.position.set(0.4, 2.56, 0.17);
body.add(box129);
const workLightL = new THREE.Mesh(boxGeo12, headlightMat);
workLightL.name = 'workLightL';
workLightL.position.set(0.4, 2.56, 0.205);
body.add(workLightL);
const box131 = new THREE.Mesh(boxGeo11, trimMat);
box131.position.set(-0.4, 2.56, 0.17);
body.add(box131);
const workLightR = new THREE.Mesh(boxGeo12, headlightMat);
workLightR.name = 'workLightR';
workLightR.position.set(-0.4, 2.56, 0.205);
body.add(workLightR);
const frontGlass = new THREE.Mesh(boxGeo13, glassMat);
frontGlass.name = 'frontGlass';
frontGlass.position.set(0, 1.865, -0.02);
body.add(frontGlass);
const rearGlass = new THREE.Mesh(boxGeo13, glassMat);
rearGlass.name = 'rearGlass';
rearGlass.position.set(0, 1.865, -1.3);
body.add(rearGlass);
const doorL = new THREE.Mesh(boxGeo14, glassMat);
doorL.name = 'doorL';
doorL.position.set(0.62, 1.865, -0.66);
body.add(doorL);
const box136 = new THREE.Mesh(boxGeo15, trimMat);
box136.position.set(0.64, 1.85, -0.25);
body.add(box136);
const doorR = new THREE.Mesh(boxGeo14, glassMat);
doorR.name = 'doorR';
doorR.position.set(-0.62, 1.865, -0.66);
body.add(doorR);
const box138 = new THREE.Mesh(boxGeo15, trimMat);
box138.position.set(-0.64, 1.85, -0.25);
body.add(box138);
const dash = new THREE.Mesh(new THREE.BoxGeometry(0.5, 0.26, 0.24), paintMat);
dash.name = 'dash';
dash.position.set(0, 1.29, -0.17);
body.add(dash);
const box140 = new THREE.Mesh(new THREE.BoxGeometry(0.46, 0.22, 0.4), trimMat);
box140.position.set(0, 1.27, -0.85);
body.add(box140);
const seat = new THREE.Mesh(new THREE.BoxGeometry(0.5, 0.1, 0.46), seatMat);
seat.name = 'seat';
seat.position.set(0, 1.43, -0.85);
body.add(seat);
const box142 = new THREE.Mesh(new THREE.BoxGeometry(0.5, 0.5, 0.1), seatMat);
box142.position.set(0, 1.76, -1.1);
box142.rotation.set(deg(-8), 0, 0);
body.add(box142);
const cylinder143 = new THREE.Mesh(new THREE.CylinderGeometry(0.025, 0.025, 0.4025, 5), trimMat);
cylinder143.position.set(0, 1.6, -0.27);
cylinder143.rotation.set(deg(-26.5651), 0, 0);
body.add(cylinder143);
const steeringWheel = new THREE.Mesh(new THREE.TorusGeometry(0.17, 0.022, 3, 10), trimMat);
steeringWheel.name = 'steeringWheel';
steeringWheel.position.set(0, 1.79, -0.38);
steeringWheel.rotation.set(deg(55), 0, 0);
body.add(steeringWheel);
const exhaust = new THREE.Mesh(new THREE.CylinderGeometry(0.05, 0.05, 1.05, 8), metalMat);
exhaust.name = 'exhaust';
exhaust.position.set(0.2, 1.985, 0.35);
body.add(exhaust);
const exhaustTip = new THREE.Mesh(new THREE.CylinderGeometry(0.065, 0.055, 0.12, 8), trimMat);
exhaustTip.name = 'exhaustTip';
exhaustTip.position.set(0.2, 2.56, 0.35);
exhaustTip.rotation.set(deg(-14), 0, 0);
body.add(exhaustTip);
const cylinder147 = new THREE.Mesh(new THREE.CylinderGeometry(0.06, 0.06, 0.38, 8), trimMat);
cylinder147.position.set(-0.2, 1.65, 0.35);
body.add(cylinder147);
const airIntake = new THREE.Mesh(new THREE.CylinderGeometry(0.11, 0.09, 0.16, 8), metalMat);
airIntake.name = 'airIntake';
airIntake.position.set(-0.2, 1.92, 0.35);
body.add(airIntake);
const cylinder149 = new THREE.Mesh(cylinderGeo8, trimMat);
cylinder149.position.set(0.35, 0.53, -1.47);
cylinder149.rotation.set(deg(-95.9316), deg(7.6021), deg(-6.855));
body.add(cylinder149);
const cylinder150 = new THREE.Mesh(cylinderGeo8, trimMat);
cylinder150.position.set(-0.35, 0.53, -1.47);
cylinder150.rotation.set(deg(-95.9316), deg(-7.6021), deg(6.855));
body.add(cylinder150);
const topLink = new THREE.Mesh(new THREE.CylinderGeometry(0.035, 0.035, 0.4205, 6), trimMat);
topLink.name = 'topLink';
topLink.position.set(0, 0.91, -1.49);
topLink.rotation.set(deg(-115.3462), 0, 0);
body.add(topLink);
const hitchBar = new THREE.Mesh(new THREE.BoxGeometry(0.86, 0.06, 0.06), metalMat);
hitchBar.name = 'hitchBar';
hitchBar.position.set(0, 0.5, -1.72);
body.add(hitchBar);
const ptoShaft = new THREE.Mesh(new THREE.CylinderGeometry(0.035, 0.035, 0.22, 6), metalMat);
ptoShaft.name = 'ptoShaft';
ptoShaft.position.set(0, 0.72, -1.38);
ptoShaft.rotation.set(deg(90), 0, 0);
body.add(ptoShaft);
root.traverse((o) => {
if (o.isMesh) {
o.castShadow = true;
o.receiveShadow = true;
}
});
return root;
}
export default createTractor;
評価とコメント
0 件のコメント
まだコメントはありません。このモデルの使い方や改善できる点を共有しましょう。
関連モデル
同じカテゴリまたは似たタグ









