Pivot Joints and apparent elasticity

UP!!! [import]uid: 140497 topic_id: 3208 reply_id: 103829[/import]

UP!!!
This problem needs a solution. [import]uid: 140497 topic_id: 3208 reply_id: 105959[/import]

Up up up!!! [import]uid: 94309 topic_id: 3208 reply_id: 105966[/import]

Yikes…

Has the issue been logged in an issue tracker, and is that getting any sort of update? Perhaps you could look there?

(Although as a paid product I’m not sure I entirely agree with *expecting* your customers to do your bug tracking for you)

Really all this thread does is highlight the largest issue with Corona - you’re at the whim of the developers. As I’ve said before I moved over to Cocos2d because of this issue, and thank god I did! I’d have been waiting over 8 months for a fix, would not have almost finished my first game, and would be tearing my hair out!

I truely hope you guys get a fix soon, but remember there are other game engines out there! [import]uid: 74917 topic_id: 3208 reply_id: 106037[/import]

@iqsoup, @guasoft, @optionniko, as I mentioned previously in this thread, the best way to get proper attention is to file bugs here:

http://developer.anscamobile.com/content/bug-submission

And in this case, we really need project files demonstrating your issue. We’re very thankful if they are small projects (e.g. the main code is just in the main.lua file) as that means we can get to fixing the issue rather than understanding your code.

Incidentally, I did a quick search. I couldn’t find any bugs under your names. Can you please give me the bug numbers?

I did find one potentially related bug but it’s not clear to me that this is your specific issue. Physics is complex, so help us help you by supplying some simple project files that isolate the issue.

I can raise attention to your issues but only if I have bug numbers to reference.
[import]uid: 26 topic_id: 3208 reply_id: 106231[/import]

Ok Walter.

Thank you very much for your answer.

As you asked, here is a video example that demonstrates the issue:

http://www.youtube.com/watch?v=qWPZWZOLgwI

And I have just sent a bug-submission to Ansca Mobile with source code in order to reproduce the problem. CASE #14233

It is very easy to reproduce: drag the head of the ragdoll over the squared “Static” body in top of the screen. You’ll see the elastic effect.

For those who want to test the effect by themselves, here is the source code: http://tinyurl.com/c7z4ea5

Please, keep us informed about this problem,

Best Regards

[import]uid: 140497 topic_id: 3208 reply_id: 106278[/import]

HELLLLOO Corona! What is the status of the bug on joint separation? This really is a deal breaker. I know the Help Desk monitors the forum, should we ALL put it bug requests?

[import]uid: 40033 topic_id: 3208 reply_id: 109763[/import]

@fava - I’m sure someone “will bring it up at the next meeting.” (wink, wink)

Please move along. Nothing to see here. [import]uid: 40137 topic_id: 3208 reply_id: 109773[/import]

Owwww! Right. :wink: [import]uid: 40033 topic_id: 3208 reply_id: 109774[/import]

FROM OCT 29, 2010 to TODAY JUNE 5, 2012

NOTHING? EVERYONE WHO POSTED HERE ARE STILL WAITING?

ANSCA STAFF? [import]uid: 40033 topic_id: 3208 reply_id: 110229[/import]

Ansca: “These aren’t the droids your looking for.”
Us: “These aren’t the droids were looking for! Move along.”

Ansca I understand this might be a tricky issue for you to resolve–I don’t know what complicates matters so much but obviously its not going to be a simple fix. All I ask for is a little openness and honesty from Ansca on this issue. Please be direct with us and explain whats going on. Is Ansca working on a solution? Are you even aware of this problem? When can we expect this issue to receive some attention? I’m not demanding am immediate solution–but please be open with us and take us seriously. We are paying customers and deserve some direct communication. If I treated my clients this way I would be out of business in a heart beat. The Ansca staff is typically very helpful with issues, very friendly and polite. But in this instance they have flat out ignored the issue and ignored all of
us. If my clients outlined a major bug in one of my products I would apologize for my mistake, tell them I’d resolve it ASAP, and then communicate often, openly, and directly until the issue was resolved. If it takes Ansca another year to fix this problem then so be it, but keep us in the loop, don’t ignore us, and PLEASE don’t tell us you don’t know what we’re talking about and don’t ignore us either. Both are just just plain rude. Ansca’s joints are unusable. That’s a fact. Every Corona joint I’ve tried to get working has inherent bugs that make it impossible to use. Apparently plenty of other people are having the exact same experience. There is no way you could be unaware of this issue. No one should need to file a bug report–this should be priority number 1 for Ansca and we should all have a time table for when this is going to get resolved. Fess up and communicate about this openly. [import]uid: 94309 topic_id: 3208 reply_id: 110316[/import]

@iqsoup i share your frustration… ive had to put projects on hold for over a year due to this issue. This is ridiculous. Ansca a little openness would be greatly appreciated? [import]uid: 58777 topic_id: 3208 reply_id: 110326[/import]

I likewise have had to suspend or abandon several projects due solely to this issue. Apparently Ansca is unable to help anyone with out a bug report. I have filed a bug report and suggest everyone else do the same. That way Ansca can’t use it as an excuse. What I would like is to have someone from Ansca come to this forum and say, “We are aware of this problem and understand its a very serious issue for lots of you. We apologize and are working hard to resolve the problem ASAP.” They can’t even humble themselves enough to say that–much less do actually anything to fix the problem. [import]uid: 94309 topic_id: 3208 reply_id: 110330[/import]

@guausoft have you heard anything back from Ansca re: your bug report? [import]uid: 94309 topic_id: 3208 reply_id: 110332[/import]

Not yet @iqsoup, not yet. This is hopeless.
[import]uid: 140497 topic_id: 3208 reply_id: 110401[/import]

I will probably be run through with a pitchfork for this “placating” advice, but I believe the upgrade to the most recent version of Box2D (inside Corona) will be added in the next couple months. I understand this is frustrating for those who have put projects aside for months already, but all I can say is, please wait a bit longer and hopefully the Box2D update will solve this. Physics improvements are on my own personal wish list too, and have been for a long time.

On that note, are we all sure this is a Corona issue and not a core Box2D issue? Do complex rag dolls behave like this in other SDKs using Box2D?

Brent Sorrentino
[import]uid: 9747 topic_id: 3208 reply_id: 110404[/import]

Fraid not, I’m using Box2D on a daily basis, this is not a Box2D issue. [import]uid: 74917 topic_id: 3208 reply_id: 110408[/import]

Back in November I posted this:

http://developer.anscamobile.com/category/tags/ragdoll

I believe the JavaScript version is Box2D so this should be a good comparison.

Unfortunately the original bug issue I posted does not exist any more and the me.com link is, of course, broken. I will try to repost.

Having said all that, I too believe there is a new Box2D implementation coming soon which will fix not just these issues but others and perhaps bring new functions. I think Walter wrote briefly about this a short while ago. [import]uid: 8271 topic_id: 3208 reply_id: 110415[/import]

Hi all, I actually do have an update. I’ve been looking at this all weekend — Peach can attest to my being up at very odd hours.

What I found was that various folks on the Box2D forums have had issues with stability on ragdolls in Box2D (not just on Corona). However, I do believe I have identified a big source of instability that is particular to Corona was in the default maxForce of the touch joint (more on that below).

As I dug deeper, I found out that ragdolls are quite a difficult problem. Erin Catto (creator of Box2D) discusses all the gory details here: http://code.google.com/p/box2d/downloads/detail?name=GDC2012_ErinCatto_Ragdolls.pdf

The one thing that came out of those slides was there’s a balancing act between the size of the bodies, the masses, etc. In other words, you have to approach objects like they are in the real, physical world.

So when you construct a ragdoll, it’s just like constructing a real bridge. If the relative masses don’t make sense, the structure will fall apart. If you place joints where there is no body, the joints become unstable.

Here were Erin’s 3 points of advice:

* Mass distribution is critical for good ragdoll stability. These rules may not seem obvious at first, but the main point is to design the ragdolls as you would a sturdy structure, such as a bridge.
* Don’t support bodies with light bodies: Would you build a bridge that is two huge parts connected by a tiny bolt in the middle? Probably not. The same design philosophy applies to ragdolls. We don’t want to support heavy bodies with light bodies. The opposite is okay. This is due to the nature of the iterative solvers used by most physics engines. They simply cannot converge large forces on small bodies.
* Don’t create gaps between bodies. Overlap between bodies helps stability, e.g. upper and lower arm collision shapes can overlap around the elbow.

Some of the models we’ve received violated that last point. The pivot joints were placed in a gap between two bodies, i.e. the joint has no mass. The easy fix is to place the pivot in the body.

Now here are the Corona quirks:
* We calculate lengths in pixels not meters.Under the hood, we use the scale factor to convert the pixels to meters before sending to Box2D. The scale factor should be chosen such that all bodies are between 0.1 and 10 meters in length. By default we use 30 pixels per meter, which maps well to the iPhone’s 320x480 size. If your range of pixels is different, you should choose an alternative scale factor.
* Beware that we calculate angles in degrees, not radians.
* The touch joint (aka mouse joint for Box2D experts) has a very large maxForce (1000 times the mass of the body).

The touch joint’s maxForce was actually a big culprit. Setting the maxForce below the default, e.g. 25% of the default, eliminates nearly all the instability. If we think about this in the real world that makes sense: a sledgehammer to someone’s elbow is going to dislocate the arm!

So one thing we’re adding is a “mass” property that you can query. That way you can set the maxForce of the touch joint to the proper multiple of the mass yourself. It’s a value you’ll have to play with.

Full disclosure: a random oddity was found where the motor was enabled for new pivot joints —by default this had no effect as the motor force was zero, but still that’s weird, so we’re going to change the default to be “off”.

Now, reducing the maxForce eliminates “nearly” all the instability. And this is the strange thing. I was able to get pivot joints in other Box2D implementations to be unstable. In particular, I did a port of Flash’s ragdoll (http://www.box2dflash.org/). In *both* the Flash version and my port, I was able to get joints to be unstable — it just took a lot more effort.

From what I read in the forums, cranking up velocity/position iterations helps improve stability (at the cost of frame rate/performance), but the balance of various parameters is still the best way to get stability.

(For those that are interested, I plan on adding the port into our sample code. Just give me some time to clean it up!)

Hopefully, this helps you understand the complexity of the issue. The big takeaway I got from digging into this was that Box2D is ultimately a simulation of the real world, so the best way to understand what’s happening is to think about an analogous situation in the real world.

Okay, long winded and long overdue, but this is a complex topic, so I wanted to give it a deep and thorough investigation before chiming back in on this thread.

walter
[import]uid: 26 topic_id: 3208 reply_id: 110419[/import]

Thank you for that Walter - it really is great to see the mass property to be added as I’ve noted that it was missing in the past.

A rag doll solution in the sample code directory would be an excellent piece to work with.

Is there a time line for the next version of Box2D in Corona?

Would it be possible to get a “Tutorial Tuesday” entry for physics world scaling - its probably the most overlooked element of any physics game development, at least IMHO.

Matt. [import]uid: 8271 topic_id: 3208 reply_id: 110437[/import]