2d Shooter
3 posters
2d Shooter
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
Re: 2d Shooter
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;
}
Re: 2d Shooter
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 );
i.e.
btCollisionWorld::ClosestRayResultCallback ray( from, to );
sio2->_SIO2physic->_btSoftRigidDynamicsWorld->getCollisionWorld()->rayTest( from, to, ray );
sctm81- Posts : 29
Join date : 2009-04-24
Re: 2d Shooter
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
btCollisionWorld::rayTest
--yarri
yarri- Posts : 81
Join date : 2009-04-10
Permissions in this forum:
You cannot reply to topics in this forum
|
|