Hi,
Qucik question : How do we designate the axe of translation for the two rigidbodies when we use btsliderconstraint to construct a slider between two rigidbodies ?
thanks you
Youne
btSliderConstraint
Re: btSliderConstraint
Please someone please help
 Dragonlord
 Posts: 192
 Joined: Mon Sep 04, 2006 5:31 pm
 Location: Switzerland
 Contact:
Re: btSliderConstraint
The axis of translation is always along the XAxis. Therefore setup a transform where the XAxis points long the direction you want to translate and feed it to the constructor. Should do the trick.

 Posts: 4
 Joined: Thu Apr 17, 2008 7:50 pm
Re: btSliderConstraint
I've been working on this too, and I don't really understand it. I've rewritten this post a few times now, but every time I test one of my theories I easily find a counterexample. It appears that the two btTransform() arguments to btSliderConstraint() define the axis of translation, and have some effect on the relative locations of the two bodies as well. Exactly what it is I cannot tell; my experiments explode every theory I have concocted, and the relevant source is very puzzling:So we see that m_sliderAxis is computed from m_calculatedTransformA, but the only comment is the rather cryptic 'along X', which seems to imply that the slider axis is first computed as though it were +x, and then transformed by m_realPivotAInW to get the real axis of translation. Could it be that you're supposed to use the transform to set the axis of rotation by transforming +x? That seems baroque, but it's my best theory yet.
On preview, I see that Dragonlord endorses this theory. I'd go with it, if I were you. As for me...how does one submit patches to the bullet mainline? This interface is crazy.
Code: Select all
void btSliderConstraint::buildJacobianInt(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB)
{
//calculate transforms
m_calculatedTransformA = rbA.getCenterOfMassTransform() * frameInA;
m_calculatedTransformB = rbB.getCenterOfMassTransform() * frameInB;
m_realPivotAInW = m_calculatedTransformA.getOrigin();
m_realPivotBInW = m_calculatedTransformB.getOrigin();
m_sliderAxis = m_calculatedTransformA.getBasis().getColumn(0); // along X
m_delta = m_realPivotBInW  m_realPivotAInW;
m_projPivotInW = m_realPivotAInW + m_sliderAxis.dot(m_delta) * m_sliderAxis;
m_relPosA = m_projPivotInW  rbA.getCenterOfMassPosition();
m_relPosB = m_realPivotBInW  rbB.getCenterOfMassPosition();
<snip>
On preview, I see that Dragonlord endorses this theory. I'd go with it, if I were you. As for me...how does one submit patches to the bullet mainline? This interface is crazy.
 Dragonlord
 Posts: 192
 Joined: Mon Sep 04, 2006 5:31 pm
 Location: Switzerland
 Contact:
Re: btSliderConstraint
The XAxis is the translation axis. Just produce a matrix ( coordinate system, relative to the object coordinate system ) in your app where the XAxis points along the translation direction and where the position is located where the origin of the translation is ( as measured later on using the limits ). FrameA becomes this coordinate system you defined. I then create a second matrix ( frameB ) which represents the same matrix as before but relative to the parent object. Set the boolean parameter to "true" to use frameA as the master frame. Doing so things should work out correctly, at least it worked for me so far.
 rponomarev
 Posts: 56
 Joined: Sat Mar 08, 2008 12:37 am
Re: btSliderConstraint
Hello,
I confirm that the slider axis is X, so the constraint solver will try to keep the same orientation for Xaxis of m_calculatedTransformA and m_calculatedTransformB.
Slider constraint is a new addition and unfortunately it is not properly documented yet.
Definition of the constraint space for slider may be a little bit confusing because the members m_frameInA and m_frameInB contain more information than needed to define the slider, so you need properly set them at slider creation time to ensure that constraint limits are not broken.
Using them I just tried to keep similarity in definition of constraints (as Hinge and 6DOF).
m_frameInA is transformation from the constraint space to BodyA space
m_frameInB is transformation from the constraint space to BodyB space
m_calculatedTransformA and m_calculatedTransformB are transformation from the constraint space to world space.
Constrain limits define the maximum discrepancies between these two transforms, boolean parameter defines which frame will be used to define limits.
Hope this will help
Roman Ponomarev
I confirm that the slider axis is X, so the constraint solver will try to keep the same orientation for Xaxis of m_calculatedTransformA and m_calculatedTransformB.
Slider constraint is a new addition and unfortunately it is not properly documented yet.
Definition of the constraint space for slider may be a little bit confusing because the members m_frameInA and m_frameInB contain more information than needed to define the slider, so you need properly set them at slider creation time to ensure that constraint limits are not broken.
Using them I just tried to keep similarity in definition of constraints (as Hinge and 6DOF).
m_frameInA is transformation from the constraint space to BodyA space
m_frameInB is transformation from the constraint space to BodyB space
m_calculatedTransformA and m_calculatedTransformB are transformation from the constraint space to world space.
Constrain limits define the maximum discrepancies between these two transforms, boolean parameter defines which frame will be used to define limits.
Hope this will help
Roman Ponomarev
Re: btSliderConstraint
I'm still a bit confused about the axis alignment stuff, even after reading these posts.
I have a problem where I have a function, that passes a btSliderConstraint into it, in order
to find the attached bodies, their location (origin) and their axis of translation.
I understand that conventionally the axis of rotation is along the Xaxis, but say if during construction
of the sliderConstraint you specified the translation along the Yaxis. How would one go about realigning
the axis to ensure the slider, slides along the yaxis?
I have a problem where I have a function, that passes a btSliderConstraint into it, in order
to find the attached bodies, their location (origin) and their axis of translation.
I understand that conventionally the axis of rotation is along the Xaxis, but say if during construction
of the sliderConstraint you specified the translation along the Yaxis. How would one go about realigning
the axis to ensure the slider, slides along the yaxis?