Page 1 of 1

raAFrame,rbBFrame in btHingeConstraint ?

Posted: Thu Jun 11, 2015 3:01 pm
by Kirity
Hello,
I am not able to understand how does parameters in raAFrame,rbBFrame are used in creating the btHingeConstraint.
btHingeConstraint(btRigidBody& rbA,
btRigidBody& rbB,
const btTransform& rbAFrame,
const btTransform& rbBFrame,
bool useReferenceFrameA = false)

Especially I am struck with understanding of "raAFrame.getBasis().setEulerZYX(XX , XX, XX) "

Also the name is showing as "setEulerZYX()" but the actual code is taking it as "X Y Z" parameters - This is also confusing.

What does setting the Euler's angles means in the context of rigidBody,btTransform and btHingeConstraint ??

To be precise I am refering to ForkLiftDemo example.

Any help is much appreciated.

Re: raAFrame,rbBFrame in btHingeConstraint ?

Posted: Thu Jun 11, 2015 9:47 pm
by Basroil
Constraints are defined by local axis locations rather than world definitions when using those frames, so a pair with world coordinates of 0,0,0 and 2,0,0 and joint directly in the center will have local coordinates of 1,0,0 and -1,0,0. Since a hinge is defined with rotation in positive Z axis direction, the joint orientation needs to also match that. Changing frames lets you make joints with initial angle values if you define a rotation about Z for one of the two. Take a look at ODE's documentation for a bit more in-depth explanation on the subject of joint constraints.

As for EulerZYX taking X,Y,Z, yes, it's confusing as hell and the source of plenty of bugs! :(

Re: raAFrame,rbBFrame in btHingeConstraint ?

Posted: Mon Jun 15, 2015 7:13 pm
by Erwin Coumans
A btTypedConstraint attaches two bodies, body A and body B. The attachment frame is expressed in local coordinate of each body, hence the name rbAframe and rbBframe.
Basroil wrote: As for EulerZYX taking X,Y,Z, yes, it's confusing as hell and the source of plenty of bugs! :(
It is best to avoid any Euler APIs in Bullet, just use a btQuaternion or a btMatrix3x3 directly.

If your application uses Euler angles, convert them yourself to a quaternion or 3x3 matrix and pass that to Bullet.

I should never have introduced or accepted patches to add the option for Euler angle conversion in Bullet,
it is better to only use quaternion and matrices. It is probably best to remove all Euler parts from the API in a future update.

Re: raAFrame,rbBFrame in btHingeConstraint ?

Posted: Wed Sep 30, 2015 8:27 pm
by Kirity
Thanks much for your explanation and reply !!!!

Now i am struct at a problem. I did success in simulating a sliderConstraint by reading values from another application.

Now the situation is - I will get slider joint movements in terms of distance moved, i.e. in millimeters.

Am not able find a solution.

Can you give your thoughts and possible solutions for do this.

Best Regards