Constraints on a rigid body

Hurricanes
Posts: 6
Joined: Wed Jun 16, 2010 8:40 am

Constraints on a rigid body

Post by Hurricanes »

Heya,

It's probably a newbish question, but I'm just getting started :).

I'm currently working on a test application to get a bit more familiar with Bullet. Basically, what I need to do is to have a rigid body on which I can apply forces and torques, but with some constraints :

1. I want to make it as if my rigid body (a simple cube in my application) is attached to some sort of spring : whenever I apply a force or a torque to it, it'll move only if the force applied is strong enough, and then it would slowly go back to its initial position/rotation, due to the force of the spring it's attached to.

2. When my cube is moving around in the scene, I don't want the cube to collide with the walls (let's say the cube is in a room :)). Basically, I want a repulsive force to be applied to the cube whenever he gets close to a wall (the closer he gets, the stronger the force is), so you really need a really strong force to actually "touch" the wall with the cube.

So, my actual question is : are there any tools already available in Bullet SDK to simulate such behaviours, or is it something I'll have to code from scratch ?

Thanks in advance,

Hurricanes
Hurricanes
Posts: 6
Joined: Wed Jun 16, 2010 8:40 am

Re: Constraints on a rigid body

Post by Hurricanes »

Any thoughts ? :(
Hurricanes
Posts: 6
Joined: Wed Jun 16, 2010 8:40 am

Re: Constraints on a rigid body

Post by Hurricanes »

Any chance I could get an answer on this, please ? Even if it's a "no, you have to do it all by yourself", at least I'll know what I have to do, which would help in planning how long this application is gonna take to develop.

Thanks in advance.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Constraints on a rigid body

Post by Dirk Gregorius »

Bullet can deal with contacts and there is also a spring constraint. Check the documentation and examples. You can also search the forum for keywords like "spring" or "contact". There is a constraint demo which might be a good start. It should be easy to modify this example to see if Bullet fullfills your needs.

HTH,
-Dirk