What is the simplest way to draw a cylinder with a slice cut out of it with three.js?

后端 未结 2 1192
情歌与酒
情歌与酒 2021-01-24 01:35

I was wondering how you would draw a cylinder with a slice cut out of it using three.js i.e. something like this: Image

All replies are much appreciated.

2条回答
  •  耶瑟儿~
    2021-01-24 02:06

    Probably the easiest way to get the shape you want is to extrude a THREE.Shape like so:

    var settings = {
        amount: 2,
        steps : 1,
        bevelEnabled: false,
        curveSegments: 24
    };
    
    var shape = new THREE.Shape();
    shape.moveTo( 0, 0 );
    shape.absarc( 0, 0, 10, 0, Math.PI * 1.75, false );
    shape.moveTo( 0, 0 );
    
    var geometry = new THREE.ExtrudeGeometry( shape, settings );
    

    fiddle: http://jsfiddle.net/0yyg5ese/

    three.js r.73

提交回复
热议问题