Horde3D
http://horde3d.org/forums/

get lifeMax from particle
http://horde3d.org/forums/viewtopic.php?f=2&t=853
Page 1 of 1

Author:  domeeGT [ 29.07.2009, 11:56 ]
Post subject:  get lifeMax from particle

Hello there,

i currently have a problem to get the param lifeMax from a particle.
My particles are getting loaded and they work like they should.

I tried the following:
Code:
lifeMax = Horde3D::getNodeParamf( nodehandle, ParticleEffectResParams::LifeMax );

But then lifeMax is returned as "-1.0737418e+008".

I also tried:
Code:
particleEffectRes = Horde3D::getNodeParami( nodehandle, EmitterNodeParams::ParticleEffectRes );
lifeMax = Horde3D::getNodeParamf( particleEffectRes, ParticleEffectResParams::LifeMax );

Which makes more sense in my opinion but particleEffectRes has the value "-2147483648" so that getNodeParamf can't work.

The particle is loaded a few lines before the above calls via:
Code:
nodehandle = Horde3D::addNodes( RootNode, ParticleResHandle );


So what am I doing wrong?
Hope someone is able to help me. Thanks

Author:  marciano [ 29.07.2009, 19:10 ]
Post subject:  Re: get lifeMax from particle

Are you sure that nodeHandle contains an Emitter node and not a Group node as root? Furthermore, ParticleEffectResParams are resource parameters, so you should query them with getResourceParamf.

BTW, all this parameter handling will be a bit clearer with Beta4.

Author:  domeeGT [ 30.07.2009, 07:36 ]
Post subject:  Re: get lifeMax from particle

Thanks! You were right. Root node was a group not an emitter.

Now it works like this:
Code:
unsigned int cnt = Horde3D::findNodes( nodehandle, "", SceneNodeTypes::Emitter );
for( int i = 0; i < cnt; i++ ) {
     particleEffectRes = Horde3D::getNodeParami( Horde3D::getNodeFindResult( i ), EmitterNodeParams::ParticleEffectRes );
     float lm = Horde3D::getResourceParamf( particleEffectRes, ParticleEffectResParams::LifeMax );
     if( lm > lifeMax ) {
          lifeMax = lm;
     }
}


That gives me the maximum lifetime of all emitters that are in the Group. Just like i wanted to have it :)

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/