Hi Bill,

I think what you want is to put the ModularEmitter under a Transform.  A Geode 
with the ParticleSystem will be a sister to the Transform.  Make sure the 
ModularEmitter has a reference to the same ParticleSystem in the Geode.  The 
ParticleSystemUpdater will also need a reference to the ParticleSystem.  You 
can control the direction (and position) of the particles with the Transform.  
I usually use a MatrixTransform.

----
Tom Jolley


________________________________
From: [email protected] 
[mailto:[email protected]] On Behalf Of Poirier, 
Guillaume
Sent: Tuesday, October 06, 2009 1:25 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] MatrixTransform and particle system

Hi Tom,

Thanks for helping out. I am indeed using a ModularEmitter and 
ParticleSystemUpdater. I was doing something like:

effect->addChild(emitter);
effect->addChild(program);
effect->addChild(updater);
geode->addChild(particleSystem);
transform->addChild(geode);
effect->addChild(transform);
root->addChild(effect);

I was expecting that if with no transform the particles are emitted towards +Z 
say, then I could add a rotation transform to emit them towards the +X axis for 
example. Not sure what was the problem with adding a MatrixTransform. The 
behavior was add one geode, the particles go towards +Z. Add a parent rotation 
to move towards +X, the particles still emit towards +Z. Now add another geode 
with particle system before previous one (no transform), and particles are 
emitted both towards +Z and +X (see first post)...

What I did to solve my problem is that I computed the theta and phi angles of 
the desired rotation and set the emitter to those values using setThetaRange() 
and setPhiRange(). This works as intended. Either there is something I was 
doing wrong / not understanding before, or maybe there is a bug somewhere in 
osgParticle...

cheers !


bill


________________________________
From: [email protected] 
[mailto:[email protected]] On Behalf Of Jolley, Thomas 
P
Sent: October-06-09 11:55 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] MatrixTransform and particle system

Hi Bill,

Do you have a ModularEmitter and ParticleSystemUpdater?  If so, where are they 
in the scene graph?

Are you expecting the particles, after being emitted, to move with the 
transform or stay in the world coordinate system.

----
Tom Jolley


________________________________
From: [email protected] 
[mailto:[email protected]] On Behalf Of Poirier, 
Guillaume
Sent: Monday, October 05, 2009 12:09 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] MatrixTransform and particle system
Yes sorry I should have mentioned that... I am using 2.8.2.


cheers !


bill

________________________________
From: [email protected] 
[mailto:[email protected]] On Behalf Of Jolley, Thomas 
P
Sent: October-05-09 12:42 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] MatrixTransform and particle system

Hi Bill,

What version of osg are you using?

----
Tom Jolley


________________________________
From: [email protected] 
[mailto:[email protected]] On Behalf Of Poirier, 
Guillaume
Sent: Monday, October 05, 2009 11:18 AM
To: OpenSceneGraph Users
Subject: [osg-users] MatrixTransform and particle system
I am trying to apply a transform to a particle system like this:

_transform = new osg::MatrixTransform;
_transform->setMatrix(osg::Matrix::rotate(fromDir, toDir));
_geode = new osg::Geode;
_geode->addDrawable(particleSystem.get());
_transform->addChild(_geode.get());
addChild(_transform.get());

Unfortunately adding the transform does not transform my particles... However 
if I add another geode like this before the previous code:

osg::ref_ptr<osg::Geode> pDummy = new osg::Geode;
pDummy->addDrawable(particleSystem.get());
addChild(pDummy.get());

Then I have one set of transformed particles and one set of untransformed ones. 
Probably I am missing something simple here ? Anyone has a suggestion ?


cheers !


bill




_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to