Getting Particles by Id/Index frustration

Post Reply
rebusbakery@gmail.com
Posts: 32
Joined: Thu Jan 05, 2012 11:49 pm

Getting Particles by Id/Index frustration

Post by rebusbakery@gmail.com » Thu May 08, 2014 8:38 pm

Trying to use the output from FindNearestNeighbors (FNN) to either change the velocity of existing nearby particles or use the found particles to spawn new particles in different emitter with ParticleAdd node.

The FNN node works, outputs a list of indexes/ids that when connected to ParticleRemoveById works fine. Unfortunately I cannot use GetParticleById because its inputs are messed up. Will not accept particles connections at its particles input! And the id input only accepts the index output from FNN, not that it matters since there is no way to get the particles in.

Also tried using the ArrayParticlesElement node, which accepts the particle object and the index list, but it complains that all the indexes are out of range despite there being the right number of particles available. The index should be found!

What am I missing? Is it possible to make the FNN node output the list of found particles at "out particles" instead of passing through all particles? What node will create a list of particles that ParticleSetChannel will accept?

User avatar
atena
Site Admin
Posts: 112
Joined: Fri Jun 04, 2010 1:25 pm

Re: Getting Particles by Id/Index frustration

Post by atena » Fri May 09, 2014 2:19 pm

If I'm not missing anything from your question I believe you need a "For" node to iterate all the neighbors of a specific particle. There is an excellent example of this technique in the demo scenes, just go to the "Help->Demo Scenes->graphs->compute_normals_based_on_neighbors".
Angel Tena
Head of RealFlow Technology
Next Limit Technologies

rebusbakery@gmail.com
Posts: 32
Joined: Thu Jan 05, 2012 11:49 pm

Re: Getting Particles by Id/Index frustration

Post by rebusbakery@gmail.com » Fri May 09, 2014 3:18 pm

Thanks for the response...

Actually the for loop is one of the things that worked. I can get the list of indexes and in the for loop step through them one at a time. The problem is there is no node that I can connect the index to and get or set the individual particle information.

The big problem, and maybe it is a bug? is that the GetParticleById will not accept any particle node at its input. That seems like the only node that will give me a particle by id/index that I can get the channels off of but I cannot give it a list of particles to choose from.

What is strange to me is that the outputs of the particle nodes that operate on a particle set do not give a list of the affected particles. Like the NearestNeighbor node... why not give a list of found particles instead of all the particles which I already have upstream? That makes no sense beyond the slight convenience of another access point to the original particle set. It would be far more useful to have the particles found by the current node and not have to chain a bunch of nodes after it to get the same info.

I would use scripts but cannot get the nearest neighbors of the particles coming from a different emitter.

rebusbakery@gmail.com
Posts: 32
Joined: Thu Jan 05, 2012 11:49 pm

Re: Getting Particles by Id/Index frustration

Post by rebusbakery@gmail.com » Fri May 09, 2014 4:56 pm

More info on the GetParticleById problem:

When dragging from the input pin, the little dot turns pink like a compound node, not blue like a particle node. All other nodes grey out when dragging from the input pin.

Tried using ArrayParticlesElement node which does output a list of particles, the count from GetParticlesInfo node shows the correct count, but using ParticleSetChannel on the element list affects ALL the particles in the emitter, not just the ones selected by the ArrayParticlesElement output.

Edit: so... does anyone know if the GetParticleById graph node is broken or what kind of particle node can plug into it if not?

User avatar
atena
Site Admin
Posts: 112
Joined: Fri Jun 04, 2010 1:25 pm

Re: Getting Particles by Id/Index frustration

Post by atena » Mon May 12, 2014 5:14 pm

Sorry, I thought that you stopped using ""GetParticleById" when using the "For" approach. I must say that this function has been deprecated in the next version of RealFlow because we detected that by mistake it went in the public release of RealFlow 2013. Our intention was to not provide access to this node because as you have detected is not working as expected. I want to apologize about it, in our experience that node is not needed having the "For" nodes, actually the reason why that node is there is because it was done before the "For" nodes to test internally that functionality. If you find any scenario where the "For" approach doesn't fulfill your needs please let us know.

Thank you very much for bringing this issue here.
Angel Tena
Head of RealFlow Technology
Next Limit Technologies

rebusbakery@gmail.com
Posts: 32
Joined: Thu Jan 05, 2012 11:49 pm

Re: Getting Particles by Id/Index frustration

Post by rebusbakery@gmail.com » Mon May 12, 2014 7:40 pm

Well, the problem remains that while I can step through the index numbers with a for loop I cannot get to the particle the index points to.

How do I get from a particle index back to the particle itself (so I can get its position and velocity) ???

User avatar
atena
Site Admin
Posts: 112
Joined: Fri Jun 04, 2010 1:25 pm

Re: Getting Particles by Id/Index frustration

Post by atena » Tue May 13, 2014 8:18 am

There is not direct access from the index to the particle. Once you have the index to the particle you can access the arrays of the properties of the particles.
Angel Tena
Head of RealFlow Technology
Next Limit Technologies

rebusbakery@gmail.com
Posts: 32
Joined: Thu Jan 05, 2012 11:49 pm

Re: Getting Particles by Id/Index frustration

Post by rebusbakery@gmail.com » Tue May 13, 2014 3:11 pm

That sounds great!. How about a hint as to what node(s) to use to do that?

User avatar
Alex
Site Admin
Posts: 143
Joined: Mon Jun 14, 2010 9:35 am

Re: Getting Particles by Id/Index frustration

Post by Alex » Tue May 13, 2014 3:41 pm

Hi there,

assuming you have an array with the indices (not IDs) of the elements you want to fetch, you need to use the GetArrayNumElement node.

Have a look at the attached graph:
getByIndices.png
You do not have the required permissions to view the files attached to this post.
Alex Ribao
RealFlow Team
Next Limit Technologies

rebusbakery@gmail.com
Posts: 32
Joined: Thu Jan 05, 2012 11:49 pm

Re: Getting Particles by Id/Index frustration

Post by rebusbakery@gmail.com » Tue May 13, 2014 3:56 pm

Ah! I see now... :idea:
Thanks!!!

Post Reply