I am working on a weather system for my FPS open world game,I set up weather types and variable winds for each type etc. I am currently working on rain useing the particle system I set up my IParticleSystemSceneNode,IParticleEmitter,IParticleAffector,ISceneNodeAnimator it works fine etc. To make a long story short how can I track the particles and check for collisions? I am trying to track the particles like this but its only tracking the particle nodes not all the particles that have been emitted.
Code: Select all
core::array<scene::ISceneNode *> particle_nodes;
world->smgr->getSceneNodesFromType(scene::ESNT_PARTICLE_SYSTEM, particle_nodes);
Console::Out("total particles %i ",(int)particle_nodes.size());
for(int i = 0; i < particle_nodes.size(); ++i)
{
if(std::string(particle_nodes[i]->getName()) != "rain") continue;
vector3df dir(((IParticleSystemSceneNode*)particle_nodes[i])->getEmitter()->getDirection());
matrix4 m;
m.setRotationDegrees(particle_nodes[i]->getRotation());
m.transformVect(dir);
vector3df new_pos(particle_nodes[i]->getPosition()-10 + -dir);
core::line3d<f32> ray;
ray.start = particle_nodes[i]->getPosition();
ray.end = ray.start + new_pos;
core::vector3df intersection;
core::triangle3df tri;
ISceneNode *selected_node = world->collision_manager->getSceneNodeAndCollisionPointFromRay(
ray,intersection,tri,0 | IDFlag_IsPickable| IDFlag_IsHighlightable,0);
// Add water spot to map
if(selected_node == this->node)
{
ISceneNode *node = world->smgr->addSphereSceneNode(5.0,16,0,IDFlag_IsPickable | IDFlag_IsHighlightable);//world->smgr->addWaterSurfaceSceneNode(weather_mesh);
node->setPosition(intersection);
//node->setMaterialTexture(0, world->driver->getTexture("data/graphics/stones.jpg"));
node->setMaterialFlag(EMF_NORMALIZE_NORMALS, true);
node->setMaterialTexture(0, world->driver->getTexture("data/graphics/water.jpg"));
//node->setMaterialType(EMT_REFLECTION_2_LAYER);
//node->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
node->setScale(vector3df(10,100.5,10));
world->smgr->addToDeletionQueue(particle_nodes[i]);
}
/*
else if (selected_node == nextcase)
{
}
*/
}
}
I seen the different emitter's have a private array of particles but I can't seem to access them?
error: 'class irr::scene::IParticleEmitter' has no member named 'Particles'