Tyrahell Posted September 8, 2014 Share Posted September 8, 2014 Hello everybody, After some time dealing with Vector3.unproject(), i got serious doubt about my way to use it. I try to unproject a screen vector (1,0,0) to a world coordinate vector and the result of unproject() is always the same even if the ViewMatrix or WorldMatrix is changing. Here is my code :var pMScene = myScene.getProjectionMatrix();var vMScene = myScene.getViewMatrix();var wMCamera = myScene.activeCamera.getWorldMatrix();var globalView = myScene.activeCamera.viewport.toGlobal(engine);var ViewportWidth = globalView.width;var ViewportHeight = globalView.height; var screenVector = new BABYLON.Vector3(1,0,0);var worldVector = BABYLON.Vector3.Unproject( screenVector, ViewportWidth, ViewportHeight, wMCamera, vMScene, pMScene );My projection Matrix is constant : 1.6, 0, 0, 0,0, 2.4, 0, 0,0, 0, 1, 10, 0, -0.1, 0 My viewMatrix depends of the scene view, quite logical, same for the worldMatrix depending from the camera fov. My viewport seems correct : width = 1200, height = 900. And my unprojected vector (1, 0, 0) is always (-0.051, 0.042, 0.1 ) Am i doing something wrong ? ++Tyra Lost in spaces... Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.