答案 0 :(得分:0)
是的,它是在平面上的投影,在三个js中执行它的简单方法是获取几何点并将它们投影到平面上
bufferGeometry的一个例子(普通几何可能会以其他方式迭代点......)
//create someplane to project to
var plane = new THREE.Plane().setFromCoplanarPoints(pointA,pointB,pointC)
//create some geometry to flatten..
var geometry = new THREE.BufferGeometry();
fillGeometry(geometry);
var positionAttr = geometry.getAttribute("position");
for(var i = 0; i < positionAttr.array.length; i+=3)
{
var point = new THREE.Vector3(positionAttr.array[i],positionAttr.array[i+1],positionAttr.array[i+2]);
var projectedPoint = plane.projectPoint();
positionAttr.array[i] = projectedPoint.x;
positionAttr.array[i+1] = projectedPoint.y;
positionAttr.array[i+2] = projectedPoint.z;
}
positionAttr.needsUpdate = true;
上面的代码会将几何体展平到由3个点给出的平面上,您可以处理数组中的某些内容,也可以将场景中的几何体用作煎饼..