'Ball' coordinate calculation in the example
如果我使用上述坐标并尝试像常规对象那样进行屏幕空间投影,则会得到极低的值(低于0.0001
)
如果我将这些值乘以700
和effect.scale
(line),则这些值将变得更加合理(0.0 & 1.0
之间的完整范围)。但是,如果我遵循以下代码,它们似乎只能在单个摄像机POV(view video)中工作:
createVector(ballx * 700, bally * 700, ballz * 700, camera, window.innerWidth, window.innerHeight);
...
function createVector(x, y, z, camera, width, height) {
var p = new THREE.Vector3(x, y, z);
var vector = p.project(camera);
vector.x = Math.round( ( vector.x + 1 ) * width / 2 );
vector.y = Math.round( ( - vector.y + 1 ) * height / 2 );
vector.z = 0;
return vector;
}
有人可以指出正确的方向来解决这个问题吗?