diff --git a/threex.domevent.js b/threex.domevent.js index 649e523..f63d1a1 100644 --- a/threex.domevent.js +++ b/threex.domevent.js @@ -209,7 +209,8 @@ THREEx.DomEvent.prototype._onMove = function(mouseX, mouseY, origDomEvent) var vector = new THREE.Vector3( mouseX, mouseY, 1 ); this._projector.unprojectVector( vector, this._camera ); - var ray = new THREE.Ray( this._camera.position, vector.subSelf( this._camera.position ).normalize() ); + var pos = this._camera.matrixWorld.getPosition().clone(); + var ray = new THREE.Ray( pos, vector.subSelf( pos ).normalize() ); var intersects = ray.intersectObjects( this._boundObjs ); var oldSelected = this._selected; @@ -250,8 +251,9 @@ THREEx.DomEvent.prototype._onEvent = function(eventName, mouseX, mouseY, origDom var vector = new THREE.Vector3( mouseX, mouseY, 1 ); this._projector.unprojectVector( vector, this._camera ); - vector.subSelf( this._camera.position ).normalize() - var ray = new THREE.Ray( this._camera.position, vector ); + var pos = this._camera.matrixWorld.getPosition().clone(); + vector.subSelf( pos ).normalize() + var ray = new THREE.Ray( pos, vector ); var intersects = ray.intersectObjects( this._boundObjs ); // if there are no intersections, return now