How to determine if an Obj collides

Post Reply
Alexandros
Posts: 2
Joined: Wed May 20, 2015 4:41 pm

How to determine if an Obj collides

Post by Alexandros »

Hi,

I would like to determine how many objects and which one is colliding everytime but I can't find an excisting function to inform me if an object is colliding. For example check this pseudoFunction "isColliding()":

Code: Select all

...
const int	numObjects=m_dynamicsWorld->getNumCollisionObjects();
int sum;
for(int i=0;i<numObjects;i++)
	{
		btCollisionObject*	colObj=m_dynamicsWorld->getCollisionObjectArray()[i];
		btRigidBody*		body=btRigidBody::upcast(colObj);

if (colObj->isColliding())
          sum+=1;

}
...
I was trying to understand the callbacks and some methods of collision objects but finally I couldn't figure out.

Is there any easy way or do I have to make my own function?

Thank you in advance
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: How to determine if an Obj collides

Post by drleviathan »

Collision callbacks are feature that many find missing in Bullet. You have to write it yourself, but there are some example implementations that can be found if you look carefully enough. Here is an older thread with one such implementation.
anthrax11
Posts: 72
Joined: Wed Feb 24, 2010 9:49 pm

Re: How to determine if an Obj collides

Post by anthrax11 »

Post Reply