Initial Commit: Custom Code - BK Flame - Mouse Move (1cs8fm87ty.js)

beta.r3js.org
-=yb4f310 2017-10-31 12:56:28 +01:00
parent 5a2376af00
commit b75e22905f
1 changed files with 28 additions and 0 deletions

28
1cs8fm87ty.js Normal file
View File

@ -0,0 +1,28 @@
//console.log(data);
this.camera = GameLib.EntityManager.Instance.findComponentById('yv62w8sx9r');
var vector = new THREE.Vector3();
vector.set(
( event.clientX / window.innerWidth ) * 2 - 1,
- ( event.clientY / window.innerHeight ) * 2 + 1,
0.5 );
vector.unproject( this.camera.instance );
vector.x = -1 * ((window.innerWidth / 2) - (data.event.clientX));
vector.y = 1 * ((window.innerHeight / 2) - (data.event.clientY));
vector.z = 0;
this.camera.lookAt.x = vector.x;
this.camera.lookAt.y = vector.y;
this.camera.lookAt.z = vector.z;
this.camera.updateInstance();
//console.log(vector.x);
return null;
//@ sourceURL=mouseMove.js