Page 1 of 1

Revolute Joint Limits are driving me crazy

Posted: Sat Dec 07, 2013 11:49 pm
by mfagerlund
Hi, I just did a ragdoll and the revolute joint limits are near impossible to get right on the first try! Some configurations are impossible for Box2D, but they're allowed in RUBE. Maybe you could put some kind of visual feedback when the angle limits are looking hinky?

cheers,
mattias

Re: Revolute Joint Limits are driving me crazy

Posted: Sun Dec 08, 2013 2:37 am
by iforce2d
What do you mean by hinky? The message log should mention that the limits are invalid if the lower limit is higher than the upper limit, but there is nothing to prevent you from setting it that way. Strictly speaking it's not impossible for Box2D to run with invalid settings like that, but of course it will be stuck in place unable to rotate.

Are you using the graphical method of setting the limits (hit 'L' while the joint is selected)? That will let you see the orientation of body B relative to body A, which should be pretty good visual feedback to get the desired limit angles.

Re: Revolute Joint Limits are driving me crazy

Posted: Sun Dec 08, 2013 7:30 am
by mfagerlund
iforce2d wrote:What do you mean by hinky? The message log should mention that the limits are invalid if the lower limit is higher than the upper limit
I wasn't aware of the log - I don't often look there, but that's good to know.
iforce2d wrote:but there is nothing to prevent you from setting it that way. Strictly speaking it's not impossible for Box2D to run with invalid settings like that, but of course it will be stuck in place unable to rotate.
I'd like a more prominent warning - for instance the joint indicators could turn from yellow to red?
iforce2d wrote:Are you using the graphical method of setting the limits (hit 'L' while the joint is selected)? That will let you see the orientation of body B relative to body A, which should be pretty good visual feedback to get the desired limit angles.
Yep, that's what I do and it's awesome. But without the log warning it's hard to know when you've switched the joint limits over. If the "Arch" of the joint is longer than expected then that's another hint that something is off.

And the log's way down at the bottom and I bet I'm not the only one constantly looking at it.

The second thing that can make a joint "hinky" is if the starting configuration is outside the allowed anchor limits. You _may_ want that, and have Box2D correct for it on the first update, but most likely you've made some kind of mistake.

I created a skinned Leonardo Ragdoll using R.U.B.E. http://youtu.be/Xks4Ehx-A2Q and too much of the (20 minutes) time was spent fiddling with the joint limits. ;)

Re: Revolute Joint Limits are driving me crazy

Posted: Mon Dec 09, 2013 10:37 am
by iforce2d
I see. I'll make the joint marker show red when the limits are invalid in the next update. Thanks for the feedback!

Re: Revolute Joint Limits are driving me crazy

Posted: Mon Dec 09, 2013 12:36 pm
by mfagerlund
Great - did you see my little film where I used rube? I'm still amazed at how fast it is working with rube!

My site for my new game is up http://learntocode.biz - rube *REALLY* helped me complete the game!

Re: Revolute Joint Limits are driving me crazy

Posted: Wed Dec 11, 2013 9:13 am
by mfagerlund
I figured out what's "wrong" with the joint limits; if you
a) first rotate both the bodies
b) create a joint between then
c) set limits

the original limits are just way off from what you'd expect - but probably correct. Zero isn't where you'd expect it to be once the bodies have been rotated. And it gets really difficult to figure out where a valid position is and which way to go to correct for it.

If neither of the bodies are rotated in their "relaxed" position, everything is fine and dandy.