934 ポリゴン0.51 × 0.80 × 0.46 m
コードで使う
エディターでリミックスfire-hydrant.js · 178 行
自己完結型の ES モジュールで、依存先は three のみです。ファクトリー関数を呼び出し、返された group をシーンに追加してください。
/**
* Fire Hydrant — Codels 3D model library
* License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
* Triangles: 934 · Size (W × H × D): 0.51 × 0.80 × 0.46 m
*
* Usage:
* import { createFireHydrant } from './fire-hydrant.js';
*
* const model = createFireHydrant();
* model.position.set(0, 0, 0);
* scene.add(model);
*/
import * as THREE from 'three';
const deg = THREE.MathUtils.degToRad;
export function createFireHydrant() {
const root = new THREE.Group();
root.name = 'FireHydrant';
// Materials
const bodyMat = new THREE.MeshStandardMaterial({ name: 'body', color: 0xc9332b, roughness: 0.55, metalness: 0.25, flatShading: true });
const capMat = new THREE.MeshStandardMaterial({ name: 'cap', color: 0xe6e1d4, roughness: 0.5, metalness: 0.3, flatShading: true });
const metalMat = new THREE.MeshStandardMaterial({ name: 'metal', color: 0x55595e, roughness: 0.45, metalness: 0.7, flatShading: true });
// Shared geometries
const cylinderGeo = new THREE.CylinderGeometry(0.014, 0.014, 0.025, 6);
const cylinderGeo2 = new THREE.CylinderGeometry(0.012, 0.012, 0.02, 6);
const cylinderGeo3 = new THREE.CylinderGeometry(0.045, 0.05, 0.07, 8);
const cylinderGeo4 = new THREE.CylinderGeometry(0.055, 0.055, 0.04, 8);
const cylinderGeo5 = new THREE.CylinderGeometry(0.022, 0.022, 0.03, 5);
const torusGeo = new THREE.TorusGeometry(0.03, 0.006, 3, 8);
// Parts
const baseFlange = new THREE.Mesh(new THREE.CylinderGeometry(0.185, 0.195, 0.05, 10), bodyMat);
baseFlange.name = 'baseFlange';
baseFlange.position.set(0, 0.025, 0);
root.add(baseFlange);
const bolt = new THREE.Mesh(cylinderGeo, metalMat);
bolt.name = 'bolt';
bolt.position.set(0.0473, 0.0625, 0.1529);
root.add(bolt);
const bolt2 = new THREE.Mesh(cylinderGeo, metalMat);
bolt2.name = 'bolt';
bolt2.position.set(0.156, 0.0625, 0.0355);
root.add(bolt2);
const bolt3 = new THREE.Mesh(cylinderGeo, metalMat);
bolt3.name = 'bolt';
bolt3.position.set(0.1087, 0.0625, -0.1174);
root.add(bolt3);
const bolt4 = new THREE.Mesh(cylinderGeo, metalMat);
bolt4.name = 'bolt';
bolt4.position.set(-0.0473, 0.0625, -0.1529);
root.add(bolt4);
const bolt5 = new THREE.Mesh(cylinderGeo, metalMat);
bolt5.name = 'bolt';
bolt5.position.set(-0.156, 0.0625, -0.0355);
root.add(bolt5);
const bolt6 = new THREE.Mesh(cylinderGeo, metalMat);
bolt6.name = 'bolt';
bolt6.position.set(-0.1087, 0.0625, 0.1174);
root.add(bolt6);
const barrel = new THREE.Mesh(new THREE.CylinderGeometry(0.115, 0.128, 0.542, 10), bodyMat);
barrel.name = 'barrel';
barrel.position.set(0, 0.321, 0);
root.add(barrel);
const belt = new THREE.Mesh(new THREE.CylinderGeometry(0.138, 0.138, 0.035, 10), bodyMat);
belt.name = 'belt';
belt.position.set(0, 0.1775, 0);
root.add(belt);
const topFlange = new THREE.Mesh(new THREE.CylinderGeometry(0.15, 0.15, 0.045, 10), bodyMat);
topFlange.name = 'topFlange';
topFlange.position.set(0, 0.6045, 0);
root.add(topFlange);
const bolt7 = new THREE.Mesh(cylinderGeo2, metalMat);
bolt7.name = 'bolt';
bolt7.position.set(0, 0.637, 0.135);
root.add(bolt7);
const bolt8 = new THREE.Mesh(cylinderGeo2, metalMat);
bolt8.name = 'bolt';
bolt8.position.set(0.1169, 0.637, 0.0675);
root.add(bolt8);
const bolt9 = new THREE.Mesh(cylinderGeo2, metalMat);
bolt9.name = 'bolt';
bolt9.position.set(0.1169, 0.637, -0.0675);
root.add(bolt9);
const bolt10 = new THREE.Mesh(cylinderGeo2, metalMat);
bolt10.name = 'bolt';
bolt10.position.set(0, 0.637, -0.135);
root.add(bolt10);
const bolt11 = new THREE.Mesh(cylinderGeo2, metalMat);
bolt11.name = 'bolt';
bolt11.position.set(-0.1169, 0.637, -0.0675);
root.add(bolt11);
const bolt12 = new THREE.Mesh(cylinderGeo2, metalMat);
bolt12.name = 'bolt';
bolt12.position.set(-0.1169, 0.637, 0.0675);
root.add(bolt12);
const bonnet = new THREE.Mesh(new THREE.SphereGeometry(0.125, 10, 4, 0, Math.PI * 2, 0, Math.PI / 2), capMat);
bonnet.name = 'bonnet';
bonnet.position.set(0, 0.627, 0);
bonnet.scale.set(1, 0.944, 1);
root.add(bonnet);
const operatingNut = new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0.035, 0.055, 5), capMat);
operatingNut.name = 'operatingNut';
operatingNut.position.set(0, 0.7675, 0);
root.add(operatingNut);
const nutWasher = new THREE.Mesh(new THREE.CylinderGeometry(0.04, 0.04, 0.012, 8), capMat);
nutWasher.name = 'nutWasher';
nutWasher.position.set(0, 0.738, 0);
root.add(nutWasher);
const sideOutlet = new THREE.Mesh(cylinderGeo3, bodyMat);
sideOutlet.name = 'sideOutlet';
sideOutlet.position.set(-0.15, 0.4, 0);
sideOutlet.rotation.set(0, 0, deg(90));
root.add(sideOutlet);
const sideCap = new THREE.Mesh(cylinderGeo4, capMat);
sideCap.name = 'sideCap';
sideCap.position.set(-0.205, 0.4, 0);
sideCap.rotation.set(0, 0, deg(90));
root.add(sideCap);
const capNut = new THREE.Mesh(cylinderGeo5, capMat);
capNut.name = 'capNut';
capNut.position.set(-0.24, 0.4, 0);
capNut.rotation.set(0, 0, deg(90));
root.add(capNut);
const chain = new THREE.Mesh(torusGeo, metalMat);
chain.name = 'chain';
chain.position.set(-0.16, 0.33, 0.03);
chain.rotation.set(0, deg(90), 0);
root.add(chain);
const sideOutlet2 = new THREE.Mesh(cylinderGeo3, bodyMat);
sideOutlet2.name = 'sideOutlet';
sideOutlet2.position.set(0.15, 0.4, 0);
sideOutlet2.rotation.set(0, 0, deg(90));
root.add(sideOutlet2);
const sideCap2 = new THREE.Mesh(cylinderGeo4, capMat);
sideCap2.name = 'sideCap';
sideCap2.position.set(0.205, 0.4, 0);
sideCap2.rotation.set(0, 0, deg(90));
root.add(sideCap2);
const capNut2 = new THREE.Mesh(cylinderGeo5, capMat);
capNut2.name = 'capNut';
capNut2.position.set(0.24, 0.4, 0);
capNut2.rotation.set(0, 0, deg(90));
root.add(capNut2);
const chain2 = new THREE.Mesh(torusGeo, metalMat);
chain2.name = 'chain';
chain2.position.set(0.16, 0.33, 0.03);
chain2.rotation.set(0, deg(90), 0);
root.add(chain2);
const pumperNozzle = new THREE.Mesh(new THREE.CylinderGeometry(0.065, 0.07, 0.07, 10), bodyMat);
pumperNozzle.name = 'pumperNozzle';
pumperNozzle.position.set(0, 0.376, 0.145);
pumperNozzle.rotation.set(deg(90), 0, 0);
root.add(pumperNozzle);
const pumperCap = new THREE.Mesh(new THREE.CylinderGeometry(0.078, 0.078, 0.05, 10), capMat);
pumperCap.name = 'pumperCap';
pumperCap.position.set(0, 0.376, 0.205);
pumperCap.rotation.set(deg(90), 0, 0);
root.add(pumperCap);
const capNut3 = new THREE.Mesh(new THREE.CylinderGeometry(0.028, 0.028, 0.035, 5), capMat);
capNut3.name = 'capNut';
capNut3.position.set(0, 0.376, 0.245);
capNut3.rotation.set(deg(90), 0, 0);
root.add(capNut3);
root.traverse((o) => {
if (o.isMesh) {
o.castShadow = true;
o.receiveShadow = true;
}
});
return root;
}
export default createFireHydrant;
評価とコメント
0 件のコメント
まだコメントはありません。このモデルの使い方や改善できる点を共有しましょう。
関連モデル
同じカテゴリまたは似たタグ









