I want to move objects along a plane parallel to the projection plane with the mouse. This means during the movement the distance between any picked object and camera projection plane (not camera position) must remain constant. A similar question has been asked: Mouse / Canvas X, Y to Three.js World X, Y, Z , but unlike there I need a solution working for arbitrary camera angles and camera/object positions not only for the plane with z=0. It also has to work for orthographic projection. Now I created a fiddle
the code in the mousemove event handler:
var v = new THREE.Vector3(
(event.clientX/window.innerWidth)*2-1,
-(event.clientY/window.innerHeight)*2+1,
1
);
projector.unprojectVector(v,camera);
var dist = circle.position.sub(camera.position,circle.position),
pos = camera.position.clone();
pos = pos.add(pos,
v.sub(v,camera.position).normalize().multiplyScalar(dist.length())
);
The circle is following the mouse position but its distance to the camera position is constant so it is actually performing a spherical movement. When switching to the ortographic camera (click) it also does not follow the mouse position as expected.