From d5fe1f3eddde1a6506c6642eee50e7a56f6c6c6f Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Sun, 12 Nov 2017 14:00:30 +0100 Subject: [PATCH] Initial Commit: CC - Mouse Down (j1gg46ln21.js) --- j1gg46ln21.js | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 j1gg46ln21.js diff --git a/j1gg46ln21.js b/j1gg46ln21.js new file mode 100644 index 0000000..02bc108 --- /dev/null +++ b/j1gg46ln21.js @@ -0,0 +1,55 @@ +if (!this.entityLoaded) { + return; +} + +/** + * First we find our crosshair + */ +var crosshair = GameLib.EntityManager.Instance.findComponentById('ah7gtz3mou'); + +/** + * Target, is the x / y postion of the crosshair on the z=0 plane in the crosshair scene + */ +var target = new THREE.Vector3(crosshair.position.x, crosshair.position.y, 0); + +/** + * We need the x/y/z position of an imaginary object, at target position, in the game scene + */ +var mInverse = new THREE.Matrix4().getInverse( crosshair.matrixWorld ); +particle.position.applyMatrix4( mInverse ); + + + +var particleEngine = GameLib.EntityManager.Instance.findComponentById('cd9s9xhs4e'); +var particle = GameLib.EntityManager.Instance.findComponentById('yployonpho'); + +var flamethrower = GameLib.EntityManager.Instance.findComponentById('69a7qg3rkb'); +var worldCamera = GameLib.EntityManager.Instance.findComponentById('0ph5bo9dyi'); + +var end = ; + +end.unproject(worldCamera.instance); + + +//var crosshairPosition = crosshair.position.instance.clone(); +//var flamethrowerPosition = worldCamera.position.instance.clone(); + +var direction = worldCamera.position.instance.clone().sub(end).normalize().negate(); + + +console.log(direction); + +particle.instance.position.x = worldCamera.position.x;// + direction.x * 0.3; +particle.instance.position.y = worldCamera.position.y;// + direction.y * 0.3; +particle.instance.position.z = worldCamera.position.z;// + direction.z * 0.3; + +var sensitivity = 0.1; + +particle.direction.instance.x = direction.x * sensitivity; +particle.direction.instance.y = direction.y * sensitivity; +particle.direction.instance.z = direction.z * sensitivity; + +particleEngine.enabled = true; + +return null; +//@ sourceURL=mouseDown.js \ No newline at end of file