630 ポリゴン2.63 × 0.95 × 0.24 m
コードで使う
エディターでリミックスbollard.js · 113 行
自己完結型の ES モジュールで、依存先は three のみです。ファクトリー関数を呼び出し、返された group をシーンに追加してください。
/**
* Bollard — Codels 3D model library
* License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
* Triangles: 630 · Size (W × H × D): 2.63 × 0.95 × 0.24 m
*
* Usage:
* import { createBollard } from './bollard.js';
*
* const model = createBollard();
* model.position.set(0, 0, 0);
* scene.add(model);
*/
import * as THREE from 'three';
export function createBollard() {
const root = new THREE.Group();
root.name = 'Bollard';
// Materials
const steelMat = new THREE.MeshStandardMaterial({ name: 'steel', color: 0x3a4046, roughness: 0.45, metalness: 0.6, flatShading: true });
const darkMat = new THREE.MeshStandardMaterial({ name: 'dark', color: 0x24272a, roughness: 0.6, metalness: 0.4, flatShading: true });
const accentMat = new THREE.MeshStandardMaterial({ name: 'accent', color: 0xe3b12c, roughness: 0.4, flatShading: true });
// Shared geometries
const cylinderGeo = new THREE.CylinderGeometry(0.11, 0.12, 0.02, 10);
const cylinderGeo2 = new THREE.CylinderGeometry(0.07, 0.07, 0.86, 10);
const sphereGeo = new THREE.SphereGeometry(0.07, 10, 3, 0, Math.PI * 2, 0, Math.PI / 2);
const cylinderGeo3 = new THREE.CylinderGeometry(0.073, 0.073, 0.05, 10);
// Parts
const bollard1 = new THREE.Group();
bollard1.name = 'bollard1';
bollard1.position.set(-1.2, 0, 0);
root.add(bollard1);
const flange = new THREE.Mesh(cylinderGeo, darkMat);
flange.name = 'flange';
flange.position.set(0, 0.01, 0);
bollard1.add(flange);
const post = new THREE.Mesh(cylinderGeo2, steelMat);
post.name = 'post';
post.position.set(0, 0.45, 0);
bollard1.add(post);
const cap = new THREE.Mesh(sphereGeo, steelMat);
cap.name = 'cap';
cap.position.set(0, 0.88, 0);
bollard1.add(cap);
const reflectiveRing = new THREE.Mesh(cylinderGeo3, accentMat);
reflectiveRing.name = 'reflectiveRing';
reflectiveRing.position.set(0, 0.685, 0);
bollard1.add(reflectiveRing);
const reflectiveRing2 = new THREE.Mesh(cylinderGeo3, accentMat);
reflectiveRing2.name = 'reflectiveRing';
reflectiveRing2.position.set(0, 0.785, 0);
bollard1.add(reflectiveRing2);
const bollard2 = new THREE.Group();
bollard2.name = 'bollard2';
root.add(bollard2);
const flange2 = new THREE.Mesh(cylinderGeo, darkMat);
flange2.name = 'flange';
flange2.position.set(0, 0.01, 0);
bollard2.add(flange2);
const post2 = new THREE.Mesh(cylinderGeo2, steelMat);
post2.name = 'post';
post2.position.set(0, 0.45, 0);
bollard2.add(post2);
const cap2 = new THREE.Mesh(sphereGeo, steelMat);
cap2.name = 'cap';
cap2.position.set(0, 0.88, 0);
bollard2.add(cap2);
const reflectiveRing3 = new THREE.Mesh(cylinderGeo3, accentMat);
reflectiveRing3.name = 'reflectiveRing';
reflectiveRing3.position.set(0, 0.685, 0);
bollard2.add(reflectiveRing3);
const reflectiveRing4 = new THREE.Mesh(cylinderGeo3, accentMat);
reflectiveRing4.name = 'reflectiveRing';
reflectiveRing4.position.set(0, 0.785, 0);
bollard2.add(reflectiveRing4);
const bollard3 = new THREE.Group();
bollard3.name = 'bollard3';
bollard3.position.set(1.2, 0, 0);
root.add(bollard3);
const flange3 = new THREE.Mesh(cylinderGeo, darkMat);
flange3.name = 'flange';
flange3.position.set(0, 0.01, 0);
bollard3.add(flange3);
const post3 = new THREE.Mesh(cylinderGeo2, steelMat);
post3.name = 'post';
post3.position.set(0, 0.45, 0);
bollard3.add(post3);
const cap3 = new THREE.Mesh(sphereGeo, steelMat);
cap3.name = 'cap';
cap3.position.set(0, 0.88, 0);
bollard3.add(cap3);
const reflectiveRing5 = new THREE.Mesh(cylinderGeo3, accentMat);
reflectiveRing5.name = 'reflectiveRing';
reflectiveRing5.position.set(0, 0.685, 0);
bollard3.add(reflectiveRing5);
const reflectiveRing6 = new THREE.Mesh(cylinderGeo3, accentMat);
reflectiveRing6.name = 'reflectiveRing';
reflectiveRing6.position.set(0, 0.785, 0);
bollard3.add(reflectiveRing6);
root.traverse((o) => {
if (o.isMesh) {
o.castShadow = true;
o.receiveShadow = true;
}
});
return root;
}
export default createBollard;
評価とコメント
0 件のコメント
まだコメントはありません。このモデルの使い方や改善できる点を共有しましょう。
関連モデル
同じカテゴリまたは似たタグ









