我没有找到正确的语法来从阵列动态生成BezierCurve,我试图推动,但它不起作用。
var x = [0,10,100,220,100, etc,...];
var y = [10,0,100,200,200, etc,...];
var z = [100,220,10,0,100, etc,...];
var points = [];
for(i=0; i < x.length; i++){
points.push( new THREE.Vector3( x[i], y[i], z[i] ) );
}
var curve = new THREE.CubicBezierCurve3( points );
var geometry = new THREE.Geometry();
var curveObject = new THREE.Line( geometry, material );
scene.add(curveObject);
一个想法?
答案 0 :(得分:1)
你可以使用
var curve = new (Function.bind.apply(THREE.CubicBezierCurve3, [null].concat(points)));
或者如果您仅定位与ES6兼容的浏览器传播运算符
var curve = new THREE.CubicBezierCurve3(...points);