有没有办法沿Three.js中的路径设置ExtrudeBufferGeometrie的初始形状方向?

时间:2019-03-26 11:43:28

标签: javascript three.js orientation

我想使用shape沿着extrudePath挤压THREE.ExtrudeBufferGeometry()

基本上可以,但是由于this question中回答的FrenetFrames,初始形状方向是任意的。
由于extrudePath位于同一平面上,因此不会因“错误”方向而关闭挤出。

var myExtrudePath = new THREE.CatmullRomCurve3( <some THREE.Vector3() vectors> );

var shape = new THREE.Shape();
shape.lineTo( ... );
...

var extrudeSettings = { extrudePath: myExtrudePath };

var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );

是否可以手动设置初始形状方向?


编辑1

我想避免编辑three.js文件。我发现了一些here。是否可以(仍然)将法线向量或帧作为ExtrudeBufferGeometry()的选项?

我想像这样的东西

var phi = Math.PI / 2;
var normal = new THREE.Vector3( Math.sin(phi), Math.cos(phi), 0);
var binormal = new THREE.Vector3( Math.cos(phi), Math.sin(phi), 0);
var frames = { normals: [normal, normal], binormals: [binormal, binormal] };

var extrudeSettings = {
    steps: 100,
    extrudePath: path,
    frames: frames
}

var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );

到目前为止,此操作无效。我在three.js:2582:4中遇到错误:

  

TypeError:v未定义

     
    

复制
    ExtrudeBufferGeometry.prototype.addShape
    ExtrudeBufferGeometry.prototype.addShapeList
    ExtrudeBufferGeometry

  

0 个答案:

没有答案