696 ポリゴン2.10 × 0.88 × 0.77 m
コードで使う
エディターでリミックスbike-rack.js · 118 行
自己完結型の ES モジュールで、依存先は three のみです。ファクトリー関数を呼び出し、返された group をシーンに追加してください。
/**
* Bike Rack — Codels 3D model library
* License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
* Triangles: 696 · Size (W × H × D): 2.10 × 0.88 × 0.77 m
*
* Usage:
* import { createBikeRack } from './bike-rack.js';
*
* const model = createBikeRack();
* model.position.set(0, 0, 0);
* scene.add(model);
*/
import * as THREE from 'three';
const deg = THREE.MathUtils.degToRad;
export function createBikeRack() {
const root = new THREE.Group();
root.name = 'BikeRack';
// Materials
const tubeMat = new THREE.MeshStandardMaterial({ name: 'tube', color: 0x2f6fa8, roughness: 0.45, metalness: 0.35, flatShading: true });
const steelMat = new THREE.MeshStandardMaterial({ name: 'steel', color: 0x5a6066, roughness: 0.5, metalness: 0.6, flatShading: true });
const boltMat = new THREE.MeshStandardMaterial({ name: 'bolt', color: 0x2b2e31, roughness: 0.5, metalness: 0.5, flatShading: true });
// Shared geometries
const cylinderGeo = new THREE.CylinderGeometry(0.026, 0.026, 0.46, 8, 1, true);
const torusGeo = new THREE.TorusGeometry(0.34, 0.026, 8, 10, Math.PI);
const boxGeo = new THREE.BoxGeometry(2.1, 0.05, 0.09);
const cylinderGeo2 = new THREE.CylinderGeometry(0.014, 0.014, 0.012, 6);
// Parts
const hoop1 = new THREE.Group();
hoop1.name = 'hoop1';
hoop1.position.set(-0.8, 0, 0);
root.add(hoop1);
const leg = new THREE.Mesh(cylinderGeo, tubeMat);
leg.name = 'leg';
leg.position.set(0, 0.28, -0.34);
hoop1.add(leg);
const leg2 = new THREE.Mesh(cylinderGeo, tubeMat);
leg2.name = 'leg';
leg2.position.set(0, 0.28, 0.34);
hoop1.add(leg2);
const bend = new THREE.Mesh(torusGeo, tubeMat);
bend.name = 'bend';
bend.position.set(0, 0.51, 0);
bend.rotation.set(0, deg(90), 0);
hoop1.add(bend);
const hoop2 = new THREE.Group();
hoop2.name = 'hoop2';
root.add(hoop2);
const leg3 = new THREE.Mesh(cylinderGeo, tubeMat);
leg3.name = 'leg';
leg3.position.set(0, 0.28, -0.34);
hoop2.add(leg3);
const leg4 = new THREE.Mesh(cylinderGeo, tubeMat);
leg4.name = 'leg';
leg4.position.set(0, 0.28, 0.34);
hoop2.add(leg4);
const bend2 = new THREE.Mesh(torusGeo, tubeMat);
bend2.name = 'bend';
bend2.position.set(0, 0.51, 0);
bend2.rotation.set(0, deg(90), 0);
hoop2.add(bend2);
const hoop3 = new THREE.Group();
hoop3.name = 'hoop3';
hoop3.position.set(0.8, 0, 0);
root.add(hoop3);
const leg5 = new THREE.Mesh(cylinderGeo, tubeMat);
leg5.name = 'leg';
leg5.position.set(0, 0.28, -0.34);
hoop3.add(leg5);
const leg6 = new THREE.Mesh(cylinderGeo, tubeMat);
leg6.name = 'leg';
leg6.position.set(0, 0.28, 0.34);
hoop3.add(leg6);
const bend3 = new THREE.Mesh(torusGeo, tubeMat);
bend3.name = 'bend';
bend3.position.set(0, 0.51, 0);
bend3.rotation.set(0, deg(90), 0);
hoop3.add(bend3);
const rail = new THREE.Mesh(boxGeo, steelMat);
rail.name = 'rail';
rail.position.set(0, 0.025, -0.34);
root.add(rail);
const bolt = new THREE.Mesh(cylinderGeo2, boltMat);
bolt.name = 'bolt';
bolt.position.set(-0.98, 0.056, -0.34);
root.add(bolt);
const bolt2 = new THREE.Mesh(cylinderGeo2, boltMat);
bolt2.name = 'bolt';
bolt2.position.set(0.98, 0.056, -0.34);
root.add(bolt2);
const rail2 = new THREE.Mesh(boxGeo, steelMat);
rail2.name = 'rail';
rail2.position.set(0, 0.025, 0.34);
root.add(rail2);
const bolt3 = new THREE.Mesh(cylinderGeo2, boltMat);
bolt3.name = 'bolt';
bolt3.position.set(-0.98, 0.056, 0.34);
root.add(bolt3);
const bolt4 = new THREE.Mesh(cylinderGeo2, boltMat);
bolt4.name = 'bolt';
bolt4.position.set(0.98, 0.056, 0.34);
root.add(bolt4);
root.traverse((o) => {
if (o.isMesh) {
o.castShadow = true;
o.receiveShadow = true;
}
});
return root;
}
export default createBikeRack;
評価とコメント
0 件のコメント
まだコメントはありません。このモデルの使い方や改善できる点を共有しましょう。
関連モデル
同じカテゴリまたは似たタグ









