Merge pull request #1662 from ZappoMan/bugfixes

set default particle lifetime to 10 seconds, make sure lifetime is always honored
This commit is contained in:
Philip Rosedale 2014-01-23 13:48:30 -08:00
commit 7e216443e9
3 changed files with 3 additions and 3 deletions

View file

@ -135,7 +135,7 @@ function checkControllerSide(whichSide) {
inHand: true,
radius: 0.05,
color: { red: 255, green: 0, blue: 0 },
lifetime: 10 // 10 seconds
lifetime: 10 // 10 seconds - same as default, not needed but here as an example
};
newParticle = Particles.addParticle(properties);

View file

@ -682,7 +682,7 @@ void Particle::update(const uint64_t& now) {
const uint64_t REALLY_OLD = 30 * USECS_PER_SECOND; // 30 seconds
bool isReallyOld = ((now - _created) > REALLY_OLD);
bool isInHand = getInHand();
bool shouldDie = getShouldDie() || (!isInHand && isStopped && isReallyOld);
bool shouldDie = (getAge() > getLifetime()) || getShouldDie() || (!isInHand && isStopped && isReallyOld);
setShouldDie(shouldDie);
runUpdateScript(); // allow the javascript to alter our state

View file

@ -42,7 +42,7 @@ const uint16_t PACKET_CONTAINS_INHAND = 128;
const uint16_t PACKET_CONTAINS_SCRIPT = 256;
const uint16_t PACKET_CONTAINS_SHOULDDIE = 512;
const float DEFAULT_LIFETIME = 60.0f * 60.0f * 24.0f; // particles live for 1 day by default
const float DEFAULT_LIFETIME = 10.0f; // particles live for 10 seconds by default
const float DEFAULT_DAMPING = 0.99f;
const float DEFAULT_RADIUS = 0.1f / TREE_SCALE;
const float MINIMUM_PARTICLE_ELEMENT_SIZE = (1.0f / 100000.0f) / TREE_SCALE; // smallest size container