Hi Ian,

The osgParticle library has its own update mechanism, see the
osgparticle example.

Robert.

On 6/18/07, Crezy Elmo <[EMAIL PROTECTED]> wrote:

Hello,

I'm implementing a particle system with very unique requirements in that every 
individual particle has different forces acting on it.   What I want to do is 
calculate the particle system physics myself at every frame, and then just let 
osg update the particle positions.

Right now I'm doing this every frame:

//Update particle positions
   for (int i=0;igetParticle(i))->setPosition( Vec3( 
(ps.particles[i]).position.x, (ps.particles[i]).position.y, 
(ps.particles[i]).position.z));
   }

Where the ps object holds my own calculations for the particle position at 
every frame.

The above code is EXTREMELY slow.  Does the right way to do this involve using 
the ParticleSystemUpdater class?

From my understanding, with osg you need to define a callback using 
setUpdateCallback for the ParticleSystemUpdater class, which then calls an 
update routine for each node.

My questions are:

1) How can I find out which particle, "i" is calling the update function, so 
that the position can be updated correctly for that individual particle?  Is there a way 
to get an id number for the particle calling the update callback?

2) Anyone have any links to  example code on how to define your own 
NodeCallback?

Thanks!

Ian
_________________________________________________________________
With Windows Live Hotmail, you can personalize your inbox with your favorite 
color.
www.windowslive-hotmail.com/learnmore/personalize.html?locale=en-us&ocid=TXT_TAGLM_HMWL_reten_addcolor_0607_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to