Two questions on constraints

yezide
Posts: 5
Joined: Mon Jan 31, 2011 2:45 pm

Two questions on constraints

Post by yezide »

Got two questions on constraints:

1) Is there any easy way to disable collision between two bodies that are connected with a constraint? Or do I have to implement a test in the btOverlapFilterCallback?

2) Is there any callback that is called when a constraint limit is reached? For example, I want to play a sound when the hinge constraint reach max or min.

Thanks in advance!
yezide
Posts: 5
Joined: Mon Jan 31, 2011 2:45 pm

Re: Two questions on constraints

Post by yezide »

And a third one while I am at it:

3) Having set limits (for hinge) with setLimit (...), how to I turn off limits (so the constraint returns to the state it was when I created it)?
mattrix
Posts: 10
Joined: Tue Feb 01, 2011 1:49 pm

Re: Two questions on constraints

Post by mattrix »

yezide wrote:Got two questions on constraints:

1) Is there any easy way to disable collision between two bodies that are connected with a constraint? Or do I have to implement a test in the btOverlapFilterCallback?

2) Is there any callback that is called when a constraint limit is reached? For example, I want to play a sound when the hinge constraint reach max or min.

Thanks in advance!
Hello!

I'm also new with bullet, but I think I can help you with the first question.
When you add the constraint you do:

Code: Select all

bool disable_collision_between_linked_bodies = true;
dynamicsWorld->addConstraint(pointer_to_your_constraint, disable_collision_between_linked_bodies);
That's all you need as far as I know.

Regards,
M.
yezide
Posts: 5
Joined: Mon Jan 31, 2011 2:45 pm

Re: Two questions on constraints

Post by yezide »

Darn, that simple :)

Thanks for the help!