From 90ef96746f64005120da24fb21c96cc6af4c8afc Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 17 Nov 2015 10:41:07 -0800 Subject: [PATCH] blockign ray --- examples/drylake/exterminatorGame/pistol.js | 2 +- examples/particles.js | 93 --------------------- 2 files changed, 1 insertion(+), 94 deletions(-) delete mode 100644 examples/particles.js diff --git a/examples/drylake/exterminatorGame/pistol.js b/examples/drylake/exterminatorGame/pistol.js index dcd9d06a99..f5b5ee89d5 100644 --- a/examples/drylake/exterminatorGame/pistol.js +++ b/examples/drylake/exterminatorGame/pistol.js @@ -171,7 +171,7 @@ function fire(side, value) { }; createMuzzleFlash(barrelTips[side]); - var intersection = Entities.findRayIntersection(pickRay, true); + var intersection = Entities.findRayIntersectionBlocking(pickRay, true); if (intersection.intersects) { Script.setTimeout(function() { createEntityHitEffect(intersection.intersection); diff --git a/examples/particles.js b/examples/particles.js deleted file mode 100644 index a46baf2dea..0000000000 --- a/examples/particles.js +++ /dev/null @@ -1,93 +0,0 @@ - -(function () { - var spawnPoint = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(Camera.getOrientation()))); - - // constructor - function TestBox() { - this.entity = Entities.addEntity({ type: "Box", - position: spawnPoint, - dimentions: { x: 1, y: 1, z: 1 }, - color: { red: 100, green: 100, blue: 255 }, - gravity: { x: 0, y: 0, z: 0 }, - visible: true, - locked: false, - lifetime: 6000}); - var self = this; - this.timer = Script.setInterval(function () { - var colorProp = { color: { red: Math.random() * 255, - green: Math.random() * 255, - blue: Math.random() * 255 } }; - Entities.editEntity(self.entity, colorProp); - }, 1000); - } - - TestBox.prototype.Destroy = function () { - Script.clearInterval(this.timer); - Entities.editEntity(this.entity, { locked: false }); - Entities.deleteEntity(this.entity); - } - - // constructor - function TestFx(color, emitDirection, emitRate, emitStrength, blinkRate) { - var PI = 3.141593; - var DEG_TO_RAD = PI / 180.0; - - this.entity = Entities.addEntity({ type: "ParticleEffect", - isEmitting: true, - position: spawnPoint, - dimensions: {x: 2, y: 2, z: 2}, - emitSpeed: 0.05, - maxParticles: 2, - speedSpread: 2, - polarFinish: 30 * DEG_TO_RAD, - emitAcceleration: {x: 0, y: -9.8, z: 0}, - textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png", - color: color, - lifespan: 1.0, - visible: true, - locked: false }); - - this.isPlaying = true; - - var self = this; - this.timer = Script.setInterval(function () { - // flip is playing state - self.isPlaying = !self.isPlaying; - var emittingProp = { isEmitting: self.isPlaying }; - Entities.editEntity(self.entity, emittingProp); - }, (1 / blinkRate) * 1000); - } - - TestFx.prototype.Destroy = function () { - Script.clearInterval(this.timer); - Entities.editEntity(this.entity, { locked: false }); - Entities.deleteEntity(this.entity); - } - - var objs = []; - function Init() { - objs.push(new TestBox()); - objs.push(new TestFx({ red: 255, green: 0, blue: 0 }, - { x: 0.5, y: 1.0, z: 0.0 }, - 100, 3, 1)); - objs.push(new TestFx({ red: 0, green: 255, blue: 0 }, - { x: 0, y: 1, z: 0 }, - 1000, 5, 0.5)); - objs.push(new TestFx({ red: 0, green: 0, blue: 255 }, - { x: -0.5, y: 1, z: 0 }, - 100, 3, 1)); - } - - function ShutDown() { - var i, len = objs.length; - for (i = 0; i < len; i++) { - objs[i].Destroy(); - } - objs = []; - } - - Init(); - Script.scriptEnding.connect(ShutDown); -})(); - -