2017-02-24 2 views
2

私は元のShapeから穴を持つMeshを作成してから、ExtrudedGeometryを作成しようとしています。問題は、私が追加する穴は、結果として得られるメッシュの高さ全体に常に詰まることです。高さを短くする方法はありますか?最終的には、全体の形状を横切ることはありませんか?押し出されたの形状のためthree.js形状の穴の高さ

リファレンスコード:

var heartShape = new THREE.Shape(); 

heartShape.moveTo(25, 25); 
heartShape.bezierCurveTo(25, 25, 20, 0, 0, 0); 
blah 

var innerCircle = new THREE.Path(); 
innerCircle.moveTo(blah); 
heartShape.holes.push(innerCircle); 

var extrudeSettings = { amount: 8, bevelEnabled: true, bevelSegments: 2, steps: 2, bevelSize: 1, bevelThickness: 1 }; 

var geometry = new THREE.ExtrudeGeometry(heartShape, extrudeSettings); 

var mesh = new THREE.Mesh(geometry, new THREE.MeshPhongMaterial()); 

ありがとう!

+1

希望するものを実現するには、「Constructive Solid Geometry」(CSG)を使用する方がよいでしょう。 [ここ](http://learningthreejs.com/blog/2011/12/10/constructive-solid-geometry-with-csg-js/)、[ここ](https://stemkoski.github)から始めてください。 io/Three.js/CSG.html)、新しい構文について[このSOスレッド](http://stackoverflow.com/questions/32778617/three-js-why-is-csg-js-not-working)を読んでください。 lib自体はここにある(https://github.com/chandlerprall/ThreeCSG) – prisoner849

+0

@ prisoner849ええ、CSGは間違いなく、この種のことについて推論するのに役立ちますが、問題はどこでも使用するには高価すぎるということです。既にそれを使用しています)。だから、私は単純で十分だが安価なアプローチを模索している。 – chaotive

答えて

1

THREE.ExtrudeGeometryに穴深さの引数はありません。それを解決するには、2つの別々の操作が必要です。

解決策の1つは、内側のサークルパスに基づいて別の押し出しを使用してプラグインすることです(最初にシェイプに変換する)。

var extrudeSettingsForPlug = { amount: 4, bevelEnabled: true, bevelSegments: 2, steps: 2, bevelSize: 1, bevelThickness: 1 }; 

var geometry = new THREE.ExtrudeGeometry(innerCircleShape, extrudeSettingsForPlug); 
関連する問題