Update: CC - Demo New - Mouse Move (n9evs68jpd.js) 689 bytes modified
parent
b969a4339c
commit
78e122fe7a
|
@ -5,10 +5,32 @@ if (!this.entityLoaded) {
|
||||||
if (!this.initialized) {
|
if (!this.initialized) {
|
||||||
this.mouse = this.entityLoaded.mouse;
|
this.mouse = this.entityLoaded.mouse;
|
||||||
this.raycaster = this.entityLoaded.raycaster;
|
this.raycaster = this.entityLoaded.raycaster;
|
||||||
|
this.camera = this.entityLoaded.camera;
|
||||||
|
this.meshImageGrid = this.entityLoaded.meshImageGrid;
|
||||||
this.initialized = true;
|
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
|
//@ sourceURL=mouseMove.js
|
Loading…
Reference in New Issue