Slider constraint axis

gunny
Posts: 2
Joined: Thu Aug 02, 2012 6:35 am

Slider constraint axis

Post by gunny »

Hi all,
I'm new to bullet so, sorry if the question is stupid.

I search all the forum and docs but I don't have found any suggestion.

I want to constraint a rigid body along an axis, I think that the correct constraint is a btSliderConstraint.
When I create that slider I have only 1 rigid body an I use the function

btSliderConstraint (btRigidBody &rbB, const btTransform &frameInB, bool useLinearReferenceFrameA)

Doing this I'm able to create only bodies that slides along X axis, all the demo shows this situation.
I try to search in the source code and I see that XAxis is the default but what I have to do to constraint a rigid body along an arbitrary axis?

Thanks.
gunny
Posts: 2
Joined: Thu Aug 02, 2012 6:35 am

Re: Slider constraint axis

Post by gunny »

Hi,
I found the solution by myself.... simple.

I use

frameB.setIdentity();
frameB.getBasis().setEulerZYX(0.f,0.f,3.14/4); // sample angles
btSliderConstraint* pSli = new btSliderConstraint(*pBody, frameB, true);

Thanks