Disable bouncing between two rigid bodies

jksuf
Posts: 2
Joined: Tue Apr 09, 2013 4:11 pm

Disable bouncing between two rigid bodies

Post by jksuf »

Hello all :) !

First of all thanks a lot to the community behind Bullet which is doing a great work, really !

I am coming here because I would like some help to solve a little issue that I have.

I have two rigid bodies. The right one is not moving and has a friction set to 1, while the left one has his friction set to 0, and has its velocity set to (2.0, 0, 0) making it moves like this:

Image

But when the left body hits the right one, it bounces and goes in the opposite direction like this :
Image

I don't want this to happen, I just want that when the left body hits the right one, it stops moving (no bounce at all). I have already tried to set both restitution to 0 but it did not work :s !

Any idea ?

Thanks for your help =) !

PS : I have another question for you guys ^^" ! How could i disable movement of a rigid body along the X axis, but only negatively ? (my body will only be able to go to the left and never to the right no matter what happens)
RBD
Posts: 141
Joined: Tue Sep 16, 2008 11:31 am

Re: Disable bouncing between two rigid bodies

Post by RBD »

Might want to try enabling "split impulse". (Assuming you've covered the basics like mass, etc.)
2nd Q: your code can do anything you want after each sim step.
jksuf
Posts: 2
Joined: Tue Apr 09, 2013 4:11 pm

Re: Disable bouncing between two rigid bodies

Post by jksuf »

Hello, thanks lot for your answer !!
I have tried your solution for the first question but unfortunately it did not work :s !

For the second question, I think (from what I have read) that 6DoF constraint can solve my problem, but I don't know how to use them at all ^^". I know that to disable movement along the X axis I just have to do:

Code: Select all

myRigidBody->setLinearFactor(btVector3(0, 1, 1));
But I just want to disable movement along the X axis in the "left" direction.
If 6DoF constraint is the solution, can someone explain me how to use it or has any link for a tutorial ? =) (I have done some research but I have not found any simple example and explanations ^^")!

Thanks a lot again =) !