2017-11-09 00:10:48 +01:00
|
|
|
if (!this.entityLoaded) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-11-11 14:46:53 +01:00
|
|
|
if (!this.initialized) {
|
|
|
|
this.initialized = true;
|
|
|
|
}
|
2017-11-09 00:10:48 +01:00
|
|
|
|
2017-11-11 14:46:53 +01:00
|
|
|
this.mouse.x = (event.offsetX / event.target.width ) * 2 - 1;
|
|
|
|
this.mouse.y = -(event.offsetY / event.target.height) * 2 + 1;
|
2017-11-09 00:10:48 +01:00
|
|
|
|
2017-11-11 14:46:53 +01:00
|
|
|
this.camera.lookAt.x = this.mouse.x;
|
|
|
|
this.camera.lookAt.y = this.mouse.y;
|
|
|
|
this.camera.updateInstance();
|
2017-11-09 00:10:48 +01:00
|
|
|
|
2017-11-11 14:46:53 +01:00
|
|
|
this.raycaster.instance.setFromCamera(
|
|
|
|
this.mouse,
|
|
|
|
this.camera.instance
|
|
|
|
);
|
2017-11-09 00:10:48 +01:00
|
|
|
|
2017-11-11 14:46:53 +01:00
|
|
|
var intersects = this.raycaster.getIntersectedObjects(this.scene.meshes);
|
2017-11-09 00:10:48 +01:00
|
|
|
|
2017-11-11 14:48:09 +01:00
|
|
|
this.cursor.position.x = this.mouse.x;
|
|
|
|
this.cursor.position.y = this.mouse.y;
|
2017-11-11 14:57:22 +01:00
|
|
|
this.cursor.position.z = 40;
|
2017-11-11 14:46:53 +01:00
|
|
|
this.cursor.updateInstance();
|
2017-11-09 00:10:48 +01:00
|
|
|
|
2017-11-11 14:46:53 +01:00
|
|
|
this.thrower.instance.lookAt(
|
2017-11-09 00:10:48 +01:00
|
|
|
new THREE.Vector3(
|
2017-11-11 14:46:53 +01:00
|
|
|
this.cursor.position.x,
|
|
|
|
this.cursor.position.y,
|
|
|
|
this.cursor.position.z
|
2017-11-09 00:10:48 +01:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
//@ sourceURL=mouseMove.js
|