Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get Renderable Particle Count
#1
Is there a way to get the number of Renderable particles used in the Oni Solver's Rendering stuff? The intent is to use this in tandem with the Oni.GetRenderableParticlePositions and Oni.SetRenderableParticlePositions methods.

Cheers
Reply
#2
(29-08-2017, 11:33 AM)PhantomBadger Wrote: Is there a way to get the number of Renderable particles used in the Oni Solver's Rendering stuff? The intent is to use this in tandem with the Oni.GetRenderableParticlePositions and Oni.SetRenderableParticlePositions methods.

Cheers

Not directly, because there's no good reason for knowing it.

Remember that each actor allocates a certain amount of particles from the solver. These particles don't have to be contiguous, so very often you´ll find that scattered groups of particles in the solver arrays actually belong to the same actor.

You could add together the amount of particles used by each actor (actor.particleIndices.Lenght) and that would be the amount of renderable positions, but there's no real use for this.

The correct way(s) to get renderable particle positions are either:
A) Get ALL of them, passing the solver's max particles as the amount of positions to retrieve. 
B) Use each actor's particleIndices array to retrieve positions for a particular actor.

if you haven´t yet, see:
http://obi.virtualmethodstudio.com/tutor...icles.html
Reply
#3
(29-08-2017, 11:48 AM)josemendez Wrote: Not directly, because there's no good reason for knowing it.

Remember that each actor allocates a certain amount of particles from the solver. These particles don't have to be contiguous, so very often you´ll find that scattered groups of particles in the solver arrays actually belong to the same actor.

You could add together the amount of particles used by each actor (actor.particleIndices.Lenght) and that would be the amount of renderable positions, but there's no real use for this.

The correct way(s) to get renderable particle positions are either:
A) Get ALL of them, passing the solver's max particles as the amount of positions to retrieve. 
B) Use each actor's particleIndices array to retrieve positions for a particular actor.

if you haven´t yet, see:
http://obi.virtualmethodstudio.com/tutor...icles.html

Awesome! Thank you Sonrisa
Reply
#4
(29-08-2017, 11:55 AM)PhantomBadger Wrote: Awesome! Thank you Sonrisa

You're welcome! oh, and just in case: actor.GetParticlePosition(index) gives you the renderable position of any particle in the actor. The index you pass goes from 0 to the amount of particles in the actor (which is particleIndices.Lenght).

This is a very convenient way to get the actual, rendered position of any particle without resorting to the lower-level stuff in the Oni class. Works both in editor and in play mode.
Reply