Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm fairly new to Bullet and started using it a week ago. I mainly played with rigid bodies and everything works as expected but now that I also need to add soft bodies into my simulation, things got a bit complicated.

What I want: I have to create a simple but unrealistic scene: the main object is a deformable ball levitating at the center of the world, it does not rest on anything and only "floats" there. Then, I should be able to throw various rigid bodies towards the ball so that it deforms BUT DOES NOT MOVE.

What I tried: My issue is that I don't know how to make my main soft body float in the center of the scene. I tried setting the mass of each of its node to zero but then it does not deform anymore, obviously. I also changed its total mass and it gives the same result (I'm not sure if it's the same as setting all masses to 0). I also tried to give it the STATIC flag but that doesn't change anything.

What I could try (but seems overcomplicated): A possibility would be to hang the ball to a fixed position with a point-to-point constraint but I'm afraid that it will deform the ball and could create an unwanted swinging motion. Another idea I had is to enclose the ball into an invisible box made of planes that would keep it in the air but that would not react with other bodies (notably the rigid ones that I will throw) but I'm afraid that this solution would be cumbersome to implement and that the faces of the box would be discernible when the ball is pressed against it.

In summary: I need to have a spherical soft body that keep the same center. It I throw something towards it, I should see its surface riple but it should not move "globally". Is there any way to cleanly do that?

Thank you for your help!

(I asked the same question on the Bullet forum but had no answers)

share|improve this question
1  
Doesn't bullet physics have a kind of joint with which you can pin it to the background? Add an angle joint so that it doesn't rotate and you should be golden! –  Roy T. Apr 2 '13 at 8:47
    
You're right! See below. –  megamoustache Apr 9 '13 at 10:53
add comment

1 Answer

up vote 0 down vote accepted

I finally found a solution.

As Roy T. mentionned, Bullet have joints that help achieve the desired result (for soft bodies only, rigid bodies rather use constraints). For examples, you can see the soft body demos bundled with the source code, especially ClusterRobot and ClusterCar.

TO solve my problem, I used a linear joint to pin the deformable sphere and an angular joint that cancels speed in order to stop its rotation.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.