|
@@ -25,7 +25,9 @@
|
|
|
var camera, scene, projector, renderer;
|
|
|
var objects = [], plane;
|
|
|
|
|
|
- var mouse = { x: 0, y: 0 }, INTERSECTED, SELECTED;
|
|
|
+ var mouse = new THREE.Vector2(),
|
|
|
+ offset = new THREE.Vector3(),
|
|
|
+ INTERSECTED, SELECTED;
|
|
|
|
|
|
init();
|
|
|
animate();
|
|
@@ -133,7 +135,7 @@
|
|
|
if ( SELECTED ) {
|
|
|
|
|
|
var intersects = ray.intersectObject( plane );
|
|
|
- SELECTED.position.copy( intersects[ 0 ].point );
|
|
|
+ SELECTED.position.copy( intersects[ 0 ].point.subSelf( offset ) );
|
|
|
return;
|
|
|
|
|
|
}
|
|
@@ -180,8 +182,10 @@
|
|
|
|
|
|
SELECTED = intersects[ 0 ].object;
|
|
|
|
|
|
- }
|
|
|
+ var intersects = ray.intersectObject( plane );
|
|
|
+ offset.copy( intersects[ 0 ].point ).subSelf( plane.position );
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function onDocumentMouseUp( event ) {
|