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

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -