CommunityBishopZ提出了一个问题:Converting World coordinates to Screen coordinates in Three.js using Projection,或许与您遇到的问题类似。
回答者mrdoob给出了该问题的处理方式:
Try with this:
var width = 640, height = 480; var widthHalf = width / 2, heightHalf = height / 2; var vector = new THREE.Vector3(); var projector = new THREE.Projector(); projector.projectVector( vector.setFromMatrixPosition( object.matrixWorld ), camera ); vector.x = ( vector.x * widthHalf ) + widthHalf; vector.y = - ( vector.y * heightHalf ) + heightHalf;
希望本文对你有帮助,欢迎支持JavaScript中文网