Questions about constraints

Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Questions about constraints

Post by Mako_energy02 »

I am starting to work more and more with constraints in my game engine and the more I work with them the more I realize I don't know much about them at all. So I have a few questions I'd like cleared up about bullet's constraints.

1. Contact and Slider constraints sound straightforward, but is that really the case? I have seen next to nothing on these forums about them, do they have any good use cases?

2. What is the Hinge2Constraint? What does it do? What is a good usage for it?

3. All constraints have these functions:

Code: Select all

virtual void setParam (int num, btScalar value, int axis=-1)
and

Code: Select all

virtual btScalar getParam (int num, int axis=-1) const
Quite simply, what do these functions do? I see they are documented as altering CFM and ERP values, but I have no clue what those acronyms mean...and I get the feeling even if I had them translated to english it still wouldn't be clear.

4. The constructor for the Point2Point constraint takes two vector3's cooresponding to the position in the objects local space the constraint should be anchored to. This makes complete sense to me. Most other constraints expect a btTransform though. Even looking at the examples I see some slightly more complicated math going on to get the numbers being passed into the constructor, and I really don't know what to make of it. If they aren't supposed to be a position in the objects local space, what exactly are the transforms being passed into the constraint?

Thanks in advance.
Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Re: Questions about constraints

Post by Mako_energy02 »

I'm still looking for any useful insights anyone may have to offer on this. Any help would be greatly appreciated.
bitshifternz
Posts: 6
Joined: Sun Apr 17, 2011 11:19 pm

Re: Questions about constraints

Post by bitshifternz »

In case you missed it, there was an answer about the meaning of CFM and ERP in this thread - http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=6565

To answer some of your other questions.

From the header of Hinge2Constraint:

// Constraint similar to ODE Hinge2 Joint
// has 3 degrees of frredom:
// 2 rotational degrees of freedom, similar to Euler rotations around Z (axis 1) and X (axis 2)
// 1 translational (along axis Z) with suspension spring

Similar to ODE is probably the main reason it exists at a guess.

I think the pivot transforms do the same as the vectors except than contain an offset and a rotation.