From 13a92bc3c9dc9c47da0102fa697806b04cb394dc Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 27 Jan 2014 11:11:20 -0800 Subject: [PATCH] tweaks to editParticle example --- examples/editParticleExample.js | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/examples/editParticleExample.js b/examples/editParticleExample.js index 4eb5dfe907..61e32c4d55 100644 --- a/examples/editParticleExample.js +++ b/examples/editParticleExample.js @@ -9,6 +9,9 @@ // var count = 0; +var moveUntil = 2000; +var stopAfter = moveUntil + 100; +var expectedLifetime = (moveUntil/60) + 1; // 1 second after done moving... var originalProperties = { position: { x: 10, @@ -28,7 +31,9 @@ var originalProperties = { color: { red: 0, green: 255, - blue: 0 } + blue: 0 }, + + lifetime: expectedLifetime }; @@ -38,17 +43,17 @@ var positionDelta = { x: 0.05, y: 0, z: 0 }; var particleID = Particles.addParticle(originalProperties); function moveParticle() { - if (count >= 100) { + if (count >= moveUntil) { //Agent.stop(); // delete it... - if (count == 100) { + if (count == moveUntil) { print("calling Particles.deleteParticle()"); Particles.deleteParticle(particleID); } // stop it... - if (count >= 200) { + if (count >= stopAfter) { print("calling Agent.stop()"); Agent.stop(); } @@ -77,16 +82,6 @@ function moveParticle() { print("newProperties.position = " + newProperties.position.x + "," + newProperties.position.y+ "," + newProperties.position.z); Particles.editParticle(particleID, newProperties); - - // also check to see if we can "find" particles... - var searchAt = { x: 9, y: 0, z: 0}; - var searchRadius = 2; - var foundParticle = Particles.findClosestParticle(searchAt, searchRadius); - if (foundParticle.isKnownID) { - print("found particle:" + foundParticle.id); - } else { - print("could not find particle in or around x=9 to x=11:"); - } }