• entries
    88
  • comments
    105
  • views
    70254

vortxGE 2.0 Particles 2

Sign in to follow this  
mixmaster

672 views

I've been working on the particle system again, fixed some issues and added some new features.

Video shows 1000 particles, emit rate 100 every 5 seconds and at death it sets each particles gravity to 0. Not sure what this feature could be used for but I just thought it would be cool to have :-)


[media='640x360']
[/media]


// ################################
// Test Particle system
asset_bs = new lsAsset_BulletShape( vortxge->getAsset_manager() );
asset_bs->Make_Box( 0.5, 0.5, 0.5 );
vortxge->getAsset_manager()->Add_Asset( "bullet/particlebox", asset_bs );

lsParticleEmitter *pe;
pe = new lsParticleEmitter( 1000, vortxge->getOpenGL(), demo_scene );
if( pe )
{
pe->position = lsVector3( 0.0, 25.0, 0.0 );
pe->setDeath_type( LSDT_PARTICLE_GRAVITY );

pe->Set_EmitRate( 100, 5*1000, 10*1000 );
pe->Set_Volume( 20.0, 5.0, 20.0 );

// Add light
demo_scene->setFoundNode(0);
demo_scene->Find_Node( demo_scene, "Spot" );
if( demo_scene->getFoundNode() )
{
lsLight *light = (lsLight*)demo_scene->getFoundNode();
pe->Add_Light( light );
}
// Set mesh
lsAsset_Mesh *amesh;

amesh = (lsAsset_Mesh*)vortxge->getAsset_manager()->Find_Asset( LSAT_MESH, "data/vbm/Cube.vbm" );
if( amesh )
{
pe->mesh = amesh->getMesh();
}
pe->Init( 1.5, asset_bs, demo_scene );
demo_scene->Add_Node( pe );

}


Sign in to follow this  


7 Comments


Recommended Comments

I was still having an issue with hiding particles before they were reset to spawn point, they still reacted with other particles, so I added this callback to my bullet world.

[Code]
bool lsFilterCallback::needBroadphaseCollision( btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1 ) const
{
bool collides = (proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask) != 0;
collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask);

//add some additional logic here that modifies 'collides'
btCollisionObject* obA = static_cast<btCollisionObject*>(proxy0->m_clientObject);
btCollisionObject* obB = static_cast<btCollisionObject*>(proxy1->m_clientObject);

// Get Scene nodes
lsNode *obj_A = (lsNode*)obA->getUserPointer();
lsNode *obj_B = (lsNode*)obB->getUserPointer();
if(( obj_A )&&( obj_B ))
{
switch( obj_A->getNode_type() )
{
case LSNT_PARTICLE:
// check physics disabled
if( obj_A->getHide() ) collides = false;
break;
}
switch( obj_B->getNode_type() )
{
case LSNT_PARTICLE:
// check physics disabled
if( obj_B->getHide() ) collides = false;
break;
}

/* Debug
cout << "Object A : ";
cout << obj_A->getName();
cout << " - hit Object B : ";
cout << obj_B->getName();
cout << endl;
*/
}
return collides;
}
[/Code]

I basically check both Nodes to see if one has Hide set to true, if so return false to ignore collision.
I also do other things to make sure the particle doesn't render etc..

Share this comment


Link to comment
LOL, it is a little annoying if you get stuck in the middle of them all, cant move... I really need to make something useful with this engine soon :-)

Any Game Designers starting out want a new engine to play with, drop me a message.

Share this comment


Link to comment
Hey man, your in for sure... But you should finish what you started first. And if you want any help I'm ready to put my hand up... Never discard anything your working on. Your game concept is sound and may make more money then other apps out there.

I'd work with you any day..

I've been watching your progress, and you have passion. no degree can even come close.

Really tell me when your ready and contact me.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now