Jump to content

  • Log In with Google      Sign In   
  • Create Account

vortxGE 2.0 Particles 2

Posted by Lee A. Stripp, 14 March 2012 · 558 views

  • vortxGE
  • vortxGE rewrite10
  • vortxGE rewrite9

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 :-)


        // ################################
        // 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->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 );

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.

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;
        switch( obj_B->getNode_type() )
            case LSNT_PARTICLE:
                // check physics disabled
                if( obj_B->getHide() ) collides = false;
        /* Debug
        cout << "Object A : ";
        cout << obj_A->getName();
        cout << "  -  hit Object B : ";
        cout << obj_B->getName();
        cout << endl;
    return collides;

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..
I would hate to be under all those falling blocks!

Looking superb as always!
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.
I would love to toy around with it, just playing 3 games of hockey a week. -.- Keep working on this though, my offer to use it still stands! :)
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.
Thanks, I appreciate that. I'm far from done my game, and believe me... I wont be quitting this project!

Keep up the great work as well!!!
Great to hear! Oh I've come to far to stop now :-)

May 2016 »

2223 24 25262728

Recent Comments