ContactTest or ContactPairTest + constraint = FAIL

Neirdan
Posts: 13
Joined: Thu Jun 13, 2013 8:07 pm

ContactTest or ContactPairTest + constraint = FAIL

Post by Neirdan »

Hi,

I posted about pressure plates earlier: http://www.bulletphysics.org/Bullet/php ... f=9&t=9270
I tried ContactTest and ContactPairTest between 2 btRigidBody that are linked by a constraint, based on the tutorial on the wiki: http://bulletphysics.org/mediawiki-1.5. ... d_Triggers

I did put

Code: Select all

virtual bool needsCollision(btBroadphaseProxy* proxy) const {
return true;
}
and even then, it does NOT check collision between 2 btRigidBody that are linked by a constraint.
However, it does work with other bodies.
Edit: I removed the constraint between the 2 bodies and the ContactPairTest/ContactTest does work once the constraint is removed.
So It's clearly related to the constraint blocking the ContactTest even if I did force needsCollision to true.
norbie
Posts: 21
Joined: Mon Feb 11, 2013 1:57 pm

Re: ContactTest or ContactPairTest + constraint = FAIL

Post by norbie »

Hello,

how did you create the constraint and add to your world?
Neirdan
Posts: 13
Joined: Thu Jun 13, 2013 8:07 pm

Re: ContactTest or ContactPairTest + constraint = FAIL

Post by Neirdan »

Code: Select all

btTransform frameInA, frameInB;
frameInA = btTransform::getIdentity();
frameInA.setOrigin(btVector3(btScalar(0.), btScalar(0.), btScalar(0.)));
frameInB = btTransform::getIdentity();
frameInB.setOrigin(btVector3(btScalar(0.), btScalar(0.), btScalar(0.)));

btGeneric6DofConstraint* pGen6DOF = new btGeneric6DofConstraint(*body, *body2, frameInA, frameInB, true);
pGen6DOF->setLinearLowerLimit(btVector3(0.,.15,0));
pGen6DOF->setLinearUpperLimit(btVector3(0.,2.8,0));

pGen6DOF->setAngularLowerLimit(btVector3(0,0,0));
pGen6DOF->setAngularUpperLimit(btVector3(0,0,0));

Game.dynamicsWorld->addConstraint(pGen6DOF, true);
Right after adding the 2 bodies to the world.
norbie
Posts: 21
Joined: Mon Feb 11, 2013 1:57 pm

Re: ContactTest or ContactPairTest + constraint = FAIL

Post by norbie »

Hello,

is it intentional to call addConstraint(pGen6DOF, true) with true as its second, disableCollisionsBetweenLinkedBodies parameter, and this way disabling collision between body and body2 ?
Neirdan
Posts: 13
Joined: Thu Jun 13, 2013 8:07 pm

Re: ContactTest or ContactPairTest + constraint = FAIL

Post by Neirdan »

There is a difference between disabling collisions (with flags or setting true) and using ContactTest.
Even if you filter collisions between 2 rigidbody with flags, ContactTest do work (if they are not linked by a constraint).

Edit: Apparently you were right, setting to true do both: it acts like a collision filter AND it filters collision during ContactTest, which I find really weird but whatever.