0
有人可以告訴我爲什麼我從我的位置值像{x:0.50516157,y:-0.62950189,z:0} {x:Infinity,y:-Infinity,z:-Infinity}我試圖將我的位置矢量投影到相機上。我發現了一個類似的查詢Converting World coordinates to Screen coordinates in Three.js using Projection,但該解決方案無法解決我的問題。如果有人可以幫助我,那將會非常有幫助。Three.js Vector.project()給出的值Infinity?
var screenvector = new THREE.Vector3();
var position = new THREE.Vector3();
position = convertLatLontoVec3(lat, lng).multiplyScalar(radius);
//convertLatLontoVec3(returns new THREE.Vector3(x, y, z);)
screenvector.copy(position);
//till here during debugging i can find the values of position.x, .y, .z
screenvector.project(camera); //But once this step is executed all the values are becoming infintiy. I don't understand why is it happening.
檢查'camera.projectionMatrix'和是否'camera.matrixWorld'是可逆的(即'new THREE.Matrix4()。getInverse(camera.matrixWorld)'')我們不能在不知道你的相機是如何設置的情況下回答你 –
恩,這是預測還是未預測?只是一個瘋狂的猜測,沒有打開NDC的圖表,但我認爲如果你在攝像頭後面,你應該會變得無窮無盡。你可能想要的屏幕矢量*未計劃* – pailhead
謝謝你的迴應,爲了更好地理解,這裏是我的代碼請看看它,如果有任何問題http://pastebin.com/ei7T0mXr – sravan