2d Shooter

View previous topic View next topic Go down

2d Shooter

Post  sctm81 on 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

View user profile

Back to top Go down

Re: 2d Shooter

Post  sio2interactive on 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;
      }



_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: 2d Shooter

Post  sctm81 on 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

View user profile

Back to top Go down

Re: 2d Shooter

Post  yarri on 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

View user profile

Back to top Go down

Re: 2d Shooter

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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