Pergunta

I was under the impression that to start a body at a specified angle of a revolute joint you set the referenceAngle. This isn't working for me. The only thing changing when altering referenceAngle is the position of the limits.

I am using box2dweb (the javascript version). I created a demo for you if you'd be so kind as to take a peek. There are two identical structures with a revolute joint. They both have angleLimits of -90deg thru 90deg. The only difference is the top structure has a referenceAngle of 0deg, while the bottom one has a referenceAngle of 90deg. And yes I know they accept angles in radians--if you look at the source you'll see I used a converter function.

Again, I'm trying to start the bodies/joint at a certain angle. I'm sure I'm probably just doing it wrong, but if this is an issue with box2dweb, is there a workaround/alternative to setting the starting angle? Or am I not using referenceAngle for the correct purpose?

Here's the -- DEMO

Foi útil?

Solução

You could define reference angle as: the angle between the two bodies at which other functions will consider the joint angle to be zero. Here 'other functions' refers to any other function of the joint that deals with angles, eg. GetJointAngle, SetLimits.

It's only necessary to have some standard baseline to measure against, like when we say Mt Everest is 8848m high, we implicitly mean it is 8848m higher than sea-level, because sea-level is by long-standing tradition considered to be zero for altitude measurements.

For example, suppose you and I are both standing facing north. The angle between us would be zero, so if you asked anybody what GetJointAngle is for us they would say zero. If I turned to face west, they would say GetJointAngle is now 90. But how about if everybody agreed that when I was facing west, we would call that zero instead... in that case, when I'm facing west they would say zero, and when I'm facing north with you again they would say -90.

Obviously a reference angle of zero is the most intuitive case and I have never found any need to set it to anything else. In fact I feel it could have been left out of the joint def structure altogether.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top