javascript - 有没有办法沿 Three.js 中的路径设置 ExtrudeBufferGeometrie 的初始形状方向?
问题描述
我想shape
沿着extrudePath
using挤出 a THREE.ExtrudeBufferGeometry()
。
基本上这工作正常,但初始形状方向是任意的,因为 FrenetFrames 回答了这个问题。
extrudePath 位于一个平面上,因此由于“错误”方向而关闭 Extrusion 永远不会出现问题。
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 文件。我在这里找到了一些东西。是否(仍然)可以将法线向量或帧作为 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 中遇到错误:
类型错误:v 未定义
复制
ExtrudeBufferGeometry.prototype.addShape
ExtrudeBufferGeometry.prototype.addShapeList
ExtrudeBufferGeometry
解决方案
推荐阅读
- mongodb - mongodb数据库工具命令不会生效
- python - 从 GCS 加载 Tensorflow TPU 中的 tfdev.hub 模型
- python - 如何使用 loc 函数为每个索引赋予单独的值?
- java - 无法使用带有 jar 文件的 javac 类路径进行编译
- apache-kafka-streams - 带有 Jaeger 跟踪的 Kafka Streams:headers() 仅应在处理记录时调用
- oracle - 当我们的条件在 oracle 中的表上匹配时,如何从触发器发送电子邮件?
- csv - 具有大量列的数据框 - 导入时会在没有数据的列中创建 NA
- go - 在发出 HTTP 请求时,Go 是否有某种方式使用 DefaultNetworkCredentials 和代理?
- php - 如何将 alt 属性放在循环内的 img cmb2 中?
- delphi - 数值返回与实际不同