Update: CC - Demo New - Mouse Move (n9evs68jpd.js) 689 bytes modified
parent
b969a4339c
commit
78e122fe7a
|
@ -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
|
Loading…
Reference in New Issue