How do I construct a hollow cylinder in Three.js

后端 未结 4 1722
伪装坚强ぢ
伪装坚强ぢ 2021-01-05 17:27

I\'m having difficulties constructing a hollow cylinder in Three.js.

Should I go and construct it using CSG or by stitching the vertices together?

4条回答
  •  忘掉有多难
    2021-01-05 18:00

    var extrudeSettings = {
        amount : 2,
        steps : 1,
        bevelEnabled: false,
        curveSegments: 8
    };
    
    var arcShape = new THREE.Shape();
    arcShape.absarc(0, 0, 1, 0, Math.PI * 2, 0, false);
    
    var holePath = new THREE.Path();
    holePath.absarc(0, 0, 0.8, 0, Math.PI * 2, true);
    arcShape.holes.push(holePath);
    
    var geometry = new THREE.ExtrudeGeometry(arcShape, extrudeSettings);
    

提交回复
热议问题