0

I have a problem with three.js. i have two particle system set ups that seem to be conflicting with each other.

The first scene loads up without problem, but when the second set loads the first set of particles vanish. This wouldn't be too confusing if it weren't for the the fact that the rest of the first scene is still appearing in the entire set up.

Is there an easy way to rename or call in the two sets of particles?

I've looked around but can't find a ref to this.

the one thing that i think might be causing this is the PARTICLE_COUNT call - which features in both scripts...

in one it is

var PARTICLE_COUNT = 15000;
var MAX_DISTANCE = 1500;
var IMAGE_SCALE = 5;

followed by

for(var i = 0; i < PARTICLE_COUNT; i++) {
    geometry.vertices.push(new THREE.Vertex());
    var star = new Star();
    stars.push(star);
}

and the second

AUDIO_FILE        = 'songs/zircon_devils_spirit',
PARTICLE_COUNT    = 250,
MAX_PARTICLE_SIZE = 12,
MIN_PARTICLE_SIZE = 2,
GROWTH_RATE       = 5,
DECAY_RATE        = 0.5,

BEAM_RATE         = 0.5,
BEAM_COUNT        = 20,

GROWTH_VECTOR = new THREE.Vector3( GROWTH_RATE, GROWTH_RATE, GROWTH_RATE ),
DECAY_VECTOR  = new THREE.Vector3( DECAY_RATE, DECAY_RATE, DECAY_RATE ),
beamGroup     = new THREE.Object3D(),
particles     = group.children,
colors        = [ 0xaaee22, 0x04dbe5, 0xff0077, 0xffb412, 0xf6c83d ],
t, dancer, kick;

followed by

dancer = new Dancer();
  kick = dancer.createKick({
    onKick: function () {
      var i;
      if ( particles[ 0 ].scale.x > MAX_PARTICLE_SIZE ) {
        decay();
      } else {
        for ( i = PARTICLE_COUNT; i--; ) {
          particles[ i ].scale.addSelf( GROWTH_VECTOR );
        }
      }
      if ( !beamGroup.children[ 0 ].visible ) {
        for ( i = BEAM_COUNT; i--; ) {
          beamGroup.children[ i ].visible = true;
        }
      }
    },
    offKick: decay
  });

  dancer.onceAt( 0, function () {
    kick.on();
  }).onceAt( 8.2, function () {
    scene.add( beamGroup );
  }).after( 8.2, function () {
    beamGroup.rotation.x += BEAM_RATE;
    beamGroup.rotation.y += BEAM_RATE;
  }).onceAt( 50, function () {
    changeParticleMat( 'white' );
  }).onceAt( 66.5, function () {
    changeParticleMat( 'pink' );
  }).onceAt( 75, function () {
    changeParticleMat();
  }).fft( document.getElementById( 'fft' ) )
    .load({ src: AUDIO_FILE, codecs: [ 'ogg', 'mp3' ]})

  Dancer.isSupported() || loaded();
  !dancer.isLoaded() ? dancer.bind( 'loaded', loaded ) : loaded();

Bit of a "needle lost in a haystack" i know...

But maybe someone can see the error of my ways!

I've tried updating the revision of three.js but r47 was as up to date as i could get it - my knowledge of three.js and dancer.js is very limited...

i also tried to create a jsfiddle - but as the earliest version on there is r54 jsfiddle won't work when i put it together... shows only parts of the whole thing... not the working version...

but maybe just the bare bones might be thing...

this one http://jsfiddle.net/wwfc/3L5z5mx… is for the file min.'s (which drives the animated/moving particles that go from one shape to another...

and this one http://jsfiddle.net/wwfc/v96L3kq… is the one that calls and sets up the audio reactive particles... this is the one that the particles (not the beams just particles) vanish from when min.'s loads up...

i can see where both scripts create the particles that are clashing but no idea of how to remedy it :-(

is there anything glaringly obvious that i need to be addressing?

wwfc
  • 1
  • 2
  • You appear to be using a version of three.js that is several years old. Update to the current version if you need help. – WestLangley Mar 20 '15 at 19:27
  • i've tried updating the revision of three.js but r47 was as up to date as i could get it - my knowledge of three.js and dancer.js are very limited... – wwfc Mar 22 '15 at 21:03
  • if you look [here][1]you will see the problem - the first particles flash up and seem to get replaced as the second lot particles load... the beams still appear on play being clicked and the audio starting. and [in this link][2]this is how the particles should be working [1]: http://dno.me.uk/dance [2]: http://dno.me.uk/dance/audio_only.html – wwfc Mar 22 '15 at 21:13
  • i know i should be using the most up to date version of three - but it requires too many changes and i don't have enough idea of what to change and look to change to be able to do it - so any help would be most welcome. – wwfc Mar 22 '15 at 21:13
  • Sorry. I can only provide help with the current version. – WestLangley Mar 22 '15 at 23:02

0 Answers0