three.js - ThreeJS: Converting from screen 2D coordinate to world 3D coordinate on the canera near plane? R73 -
i got little bit in trouble coordinate conversion. have object on screen known coordinates (x,y) , want convert world coordinates (x,y,z) projected on camera's near plane.
so far, can make projection onto z plane this:
var vector = new three.vector3( mouse.x, mouse.y, 1 ); vector.unproject( camera );
but unfortunately cannot proceed further :(
if use -1 z component, you'll projected on near plane, instead far plane:
var vector = new three.vector3( mouse.x, mouse.y, -1 ).unproject( camera );
assuming mouse.x , mouse.y between -1 , 1.
three.js r.73
Comments
Post a Comment