diff --git a/n9evs68jpd.js b/n9evs68jpd.js index 80a1052..86ce970 100644 --- a/n9evs68jpd.js +++ b/n9evs68jpd.js @@ -3,12 +3,34 @@ if (!this.entityLoaded) { } if (!this.initialized) { - this.mouse = this.entityLoaded.mouse; - this.raycaster = this.entityLoaded.raycaster; + this.mouse = this.entityLoaded.mouse; + this.raycaster = this.entityLoaded.raycaster; + this.camera = this.entityLoaded.camera; + this.meshImageGrid = this.entityLoaded.meshImageGrid; this.initialized = true; } +this.mouse.x = (data.event.offsetX / data.event.target.width ) * 2 - 1; +this.mouse.y = -(data.event.offsetY / data.event.target.height) * 2 + 1; -return null; +//this.camera.lookAt.x = this.mouse.x * 20; +//this.camera.lookAt.y = this.mouse.y * 20; +//this.camera.lookAt.z = 0; +//this.camera.updateInstance('lookAt'); + +this.raycaster.setFromCamera( + this.mouse, + this.camera +); + +var distance = - this.camera.position.z / this.raycaster.direction.z; +var cursorPosition = this.camera.position.clone().add( + this.raycaster.direction.clone().multiply( + distance, + true + ) +); + +this.meshImageGrid.lookAt(cursorPosition); //@ sourceURL=mouseMove.js \ No newline at end of file