FeedBack Collision

miccinov
Posts: 8
Joined: Fri Apr 15, 2011 9:18 am

FeedBack Collision

Post by miccinov »

Hi, how i can get witch rigidbody are colliding or how i can test if a determinate rigidbody is colliding?
I try with this code:


int numManifolds = this->mWorld->getDispatcher()->getNumManifolds();
for (int i=0;i<numManifolds;i++)
{
btPersistentManifold* contactManifold = this->mWorld->getDispatcher()->getManifoldByIndexInternal(i);
btCollisionObject* colA=static_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* colB=static_cast<btCollisionObject*>(contactManifold->getBody1());

int numContacts = contactManifold->getNumContacts();
for (int j=0;j<numContacts;j++){
btManifoldPoint& pt = contactManifold->getContactPoint(j);
if (pt.getDistance()<0.f)
this->getFeedBack(colA,colB);

}

Where getFeedBack is:

void BaseApplication::getFeedBack(btCollisionObject* collisionA,btCollisionObject* collisionB){
if(this->esoscheletro[0]->getUserPointer()==collisionA->getUserPointer()||this->esoscheletro[0]->getUserPointer()==collisionB->getUserPointer())
this->colR_Index1=true;
else
this->colR_Index1=false;

}

So, i have a control on userPoint...but this don't work.
o.o
User avatar
chaosavy
Posts: 29
Joined: Wed Nov 11, 2009 9:09 pm

Re: FeedBack Collision

Post by chaosavy »

that looks ok, maybe you don't get any responses because you didn't setup your ridgid bodies correctly, or if you did set them up correctly they aren't colliding

try turning the debug drawer on and seeing what is actually happening on the physics side