diff --git a/56if6ltmvm.js b/56if6ltmvm.js index 60b817a..20fa1bc 100644 --- a/56if6ltmvm.js +++ b/56if6ltmvm.js @@ -2,54 +2,51 @@ if (!this.entityLoaded) { return; } -/** - * First we find our crosshair - */ -var crosshair = GameLib.EntityManager.Instance.findComponentById('jl8hpa2pel'); +var codeSnippet = function(type, rotation, scale, position) { + code = "mesh = " + type + ".clone();\n" + + code += "mesh.position.x = " + position.x + ";\n"; + code += "mesh.position.y = " + position.y + ";\n"; + code += "mesh.position.z = " + position.z + ";\n"; + + code += "mesh.rotation.x = " + rotation.x + ";\n"; + code += "mesh.rotation.y = " + rotation.y + ";\n"; + code += "mesh.rotation.z = " + rotation.z + ";\n"; + + code += "mesh.scale.x = " + scale.x + ";\n"; + code += "mesh.scale.y = " + scale.y + ";\n"; + code += "mesh.scale.z = " + scale.z + ";\n"; + + code += "mesh.updateInstance();\n\n"; + return code; +} -/** - * 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); +var code = ''; -/** - * 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 meshes = GameLib.EntityManager.Instance.queryComponents(GameLib.D3.Mesh); +meshes.map( + function(mesh) { + if (mesh.name.indexOf('Tree - Small Clone') !== -1) { + code += codeSnippet('treeSmall', mesh.rotation, mesh.scale, mesh.position); + } + if (mesh.name.indexOf('Tree - Medium Clone') !== -1) { + code += codeSnippet('treeMedium', mesh.rotation, mesh.scale, mesh.position); + } + if (mesh.name.indexOf('Tree - Large Clone') !== -1) { + code += codeSnippet('treeLarge', mesh.rotation, mesh.scale, mesh.position); + } + if (mesh.name.indexOf('Stone 1 Clone') !== -1) { + code += codeSnippet('stone1', mesh.rotation, mesh.scale, mesh.position); + } + if (mesh.name.indexOf('Stone 2 Clone') !== -1) { + code += codeSnippet('stone2', mesh.rotation, mesh.scale, mesh.position); + } + } +); +console.log(code); -var particleEngine = GameLib.EntityManager.Instance.findComponentById('mwnydjz3ez'); -var particle = GameLib.EntityManager.Instance.findComponentById('ks1yk4yi1n'); - -var flamethrower = GameLib.EntityManager.Instance.findComponentById('y548ddx1ff'); -var worldCamera = GameLib.EntityManager.Instance.findComponentById('zc2pq229fq'); - -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