260 三角面0.39 × 0.73 × 0.39 m
在代码中使用
在编辑器中改编traffic-cone.js · 60 行
自包含的 ES 模块,仅依赖 three。调用工厂函数,然后把返回的 group 添加到场景中。
/**
* Traffic Cone — Codels 3D model library
* License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
* Triangles: 260 · Size (W × H × D): 0.39 × 0.72 × 0.39 m
*
* Usage:
* import { createTrafficCone } from './traffic-cone.js';
*
* const model = createTrafficCone();
* model.position.set(0, 0, 0);
* scene.add(model);
*/
import * as THREE from 'three';
export function createTrafficCone() {
const root = new THREE.Group();
root.name = 'TrafficCone';
// Materials
const coneMat = new THREE.MeshStandardMaterial({ name: 'cone', color: 0xf26a1b, roughness: 0.6, flatShading: true });
const stripeMat = new THREE.MeshStandardMaterial({ name: 'stripe', color: 0xf4f4f0, roughness: 0.3, metalness: 0.1, flatShading: true });
const baseMat = new THREE.MeshStandardMaterial({ name: 'base', color: 0x26292c, roughness: 0.9, flatShading: true });
// Parts
const base = new THREE.Mesh(new THREE.BoxGeometry(0.385, 0.0315, 0.385), baseMat);
base.name = 'base';
base.position.set(0, 0.0158, 0);
root.add(base);
const baseCollar = new THREE.Mesh(new THREE.CylinderGeometry(0.159, 0.167, 0.0252, 12), baseMat);
baseCollar.name = 'baseCollar';
baseCollar.position.set(0, 0.0315, 0);
root.add(baseCollar);
const cone = new THREE.Mesh(new THREE.CylinderGeometry(0.0245, 0.147, 0.6685, 12), coneMat);
cone.name = 'cone';
cone.position.set(0, 0.3658, 0);
root.add(cone);
const tip = new THREE.Mesh(new THREE.SphereGeometry(0.025, 8, 4, 0, Math.PI * 2, 0, Math.PI / 2), coneMat);
tip.name = 'tip';
tip.position.set(0, 0.7, 0);
root.add(tip);
const stripe = new THREE.Mesh(new THREE.CylinderGeometry(0.0993, 0.1152, 0.0869, 12), stripeMat);
stripe.name = 'stripe';
stripe.position.set(0, 0.2855, 0);
root.add(stripe);
const stripe2 = new THREE.Mesh(new THREE.CylinderGeometry(0.0625, 0.0785, 0.0869, 12), stripeMat);
stripe2.name = 'stripe';
stripe2.position.set(0, 0.4861, 0);
root.add(stripe2);
root.traverse((o) => {
if (o.isMesh) {
o.castShadow = true;
o.receiveShadow = true;
}
});
return root;
}
export default createTrafficCone;
评分与评论
0 条评论
暂无评论。分享一下你是如何使用这个模型的,或者有哪些可以改进的地方。
相关模型
同一分类或相似标签









