Three.js - 形状和内孔的问题

时间:2012-07-17 21:59:21

标签: javascript three.js

我遇到了一个问题,我怎样才能获得一种像圆环一样的“开环”? 我尝试了一个形状加一条路径作为一个洞:

var arcShape = new THREE.Shape();   
arcShape.moveTo( 40, 0 );   
arcShape.arc( 0, 0, 40, 0, 2*Math.PI, false );  

var holePath = new THREE.Path();
holePath.moveTo( 30,0 )
holePath.arc( 0, 0, 30, 0, 2*Math.PI, true );

直到现在,制作一个网格:

new THREE.Mesh( arcShape.extrude({ amount: 5, bevelEnabled: false }), MATERIAL );

它有效,但如何制作中环?我的意思是:

 var arcShape = new THREE.Shape();  
 arcShape.moveTo( 40, 0 );  
 arcShape.arc( 0, 0, 40, 0, Math.PI, false );   

 var holePath = new THREE.Path();
 holePath.moveTo( 30,0 );
 holePath.arc( 0, 0, 30, 0, Math.PI, true );

它有效,但它仍然是终端部件之间的微妙面孔......有没有办法让它完全打开?

1 个答案:

答案 0 :(得分:2)

尝试更改Torus几何构造函数中的参数,而不是从方形一开始:

// Torus geometry parameters:
//     radius of entire torus,
//     diameter of tube (should be less than total radius), 
//     segments around radius, 
//     segments around torus ("sides")
var torusGeom = new THREE.TorusGeometry( 25, 10, 4, 4 );