FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

2d Shooter

3 posters

Go down

2d Shooter Empty 2d Shooter

Post  sctm81 Fri May 15, 2009 1:54 am

My goal is to develop a 2D shooter with SIO2. Is using the bullet API the best approach to detect hits?

sctm81

Posts : 29
Join date : 2009-04-24

Back to top Go down

2d Shooter Empty Re: 2d Shooter

Post  sio2interactive Fri May 15, 2009 1:57 am

Get the contact points:

Code:


      unsigned int i = 0,
                j;

      while( i != _SIO2physic->_btSoftRigidDynamicsWorld->getDispatcher()->getNumManifolds() )
      {
         btPersistentManifold *_btPersistentManifold = _SIO2physic->_btSoftRigidDynamicsWorld->getDispatcher()->getManifoldByIndexInternal( i );

         j = 0;
         while( j != _btPersistentManifold->getNumContacts() )
         {
            btRigidBody *_btRigidBody = ( btRigidBody * )_btPersistentManifold->getBody0();

            
            ++j;
         }

         
         ++i;
      }


sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

2d Shooter Empty Re: 2d Shooter

Post  sctm81 Tue May 19, 2009 2:07 am

I was wondering if you could tell me the difference between the approach you just posted and the ray collision presented in tutorial 9?

i.e.

btCollisionWorld::ClosestRayResultCallback ray( from, to );
sio2->_SIO2physic->_btSoftRigidDynamicsWorld->getCollisionWorld()->rayTest( from, to, ray );

sctm81

Posts : 29
Join date : 2009-04-24

Back to top Go down

2d Shooter Empty Re: 2d Shooter

Post  yarri Tue May 19, 2009 12:50 pm

rayTest( from, to, ray ) casts a "ray" from and observer ("from") to an point in the distance ("to") and returns a list of collision objects. You can check the Bullet manual, here:

btCollisionWorld::rayTest

--yarri

yarri

Posts : 81
Join date : 2009-04-10

Back to top Go down

2d Shooter Empty Re: 2d Shooter

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum