Pivot Joints and apparent elasticity

Thanks for the write up, Walter. Glad to see these issues finally getting some attention. Indeed, I’ve been able to work around *most* of my problems with ragdoll simulations with careful tweaking of mass/density parameters of each body part. Still, some issues remain, and your comments raised a couple questions for me:

  1. If Corona uses pixels instead of meters to determine the physics scale factor how does that jibe with the cross-platform, retina vs. non-retina display issues we as developers have to contend with? Wouldn’t that mean physics will behave differently on an iPhone 3GS vs. a new iPad with Retina? I’ve noticed some differences in physics behavior between devices and wonder if this is the root cause, and if so, how to work around it.

  2. Treating the physics simulation as if it was the real world is generally good advice, but I would say in a “typical” use case absolute reality is not the ultimate goal, and is often a reason why the physics simulation results in unwanted effects. For example, in my game, the ragdoll gets flung around and sometimes catches a limb (or her head) on an immovable brick, causing her to be temporarily dismembered. Sure, in the real world such a collision would result in a headless ragdoll, but that’s NOT the effect I want in my game world. I want the added realism that a ragdoll/physics simulation provides, but I want to be able to control that realism under certain extreme situations. It seems like, at least in the current implementation of Box2D in Corona, these are opposing goals, but any advice towards achieving both would be appreciated. [import]uid: 9422 topic_id: 3208 reply_id: 110514[/import]

Walter, thank you very much. [import]uid: 40033 topic_id: 3208 reply_id: 110524[/import]

Walter, thank you very much for communicating with us on this. We understand issue might take a while to resolve, thanks for being open and honest about everything. [import]uid: 94309 topic_id: 3208 reply_id: 110536[/import]

@horacebury, the new box2D library is one of our “stretch” goals for the first feature cycle (which should start soon after the next public release which we hope to get out within a week). For the tutorial, maybe some discussion on why lengths matter and some general guidelines on how to choose the appropriate world scale?

@XenonBL, yes you’re right, I meant to say content pixels (not screen pixels). If you have content scaling turned on, then you should get consistent results.

Regarding thinking in terms of the real world, I didn’t mean to imply that Corona’s Box2D was aiming for realism. I meant it only as a guideline for how to think about what’s going on when Box2D is behaving in unexpected or undesired ways.

Can you get the limb catching to occur when you’re moving the mouse slowly, or only when you’re moving the mouse quickly?

My suggestion about the limb catching is to reduce the maxForce of the touch joint, as I mentioned above. That’s the biggest difference I’ve seen. Since the mass property isn’t available yet, try doing something like:

local joint = physics.newJoint( ... )  
joint.maxForce = 0.25 \* joint.maxForce -- temporary hack until the 'mass' property is available  

[import]uid: 26 topic_id: 3208 reply_id: 110539[/import]

@walter
In my particular case I’m not using touch joints to drag the ragdoll around with the mouse. I connect my ragdoll parts with pivot joints and use forces/impulses to “push” the body around in the simulation. The dismemberment occurs when the ragdoll collides with another, usually static, object. From the docs I understood that maxForce property is only available for friction joints, or is that not the case and I can set maxForce on pivot (and touch) joints as well? Will the mass property be available for pivot joints as well as touch joints?

[import]uid: 9422 topic_id: 3208 reply_id: 110550[/import]

My issue is exactly the same as XenonBL; I’m not using touch joints either. When another body collides with another body, the pivot joints separate. There doesn’t seem to be a .maxforce with pivots. [import]uid: 40033 topic_id: 3208 reply_id: 110554[/import]

Touch joints have a maxForce property. In this case, the max force refers to the maximum force applied to the body that you are touching. I think the analogy is: if you were to grab an arm, what is the maximum force you could apply?

When the ‘mass’ property is available as part of the body object, you can set the maxForce as a multiple, e.g. joint.maxForce = 200*body.mass.

@XenonBL, can you send me more details via the bug form (that way we can track this)? For example, how are you determining how large a force or impulse to use? If you start reducing the ragdoll to just a few limbs, can you reproduce the separation? [import]uid: 26 topic_id: 3208 reply_id: 110556[/import]

I submitted a new bug report, #14791 with a few details.

As a side complaint, I have a couple beefs with your bug submit process:

  1. Why am I *required* to submit code for the bug to be accepted? It’s not always convenient, or even possible, to rip out a “simple, reproducible” case for every single issue. I submitted a dummy lua file just to get this bug filed for your tracking convenience.

  2. If I log into fogBugz and search for 14791 nothing is found. If I enter that number as a “case ticket” nothing is found. If I search for “ragdoll” or even “physics” nothing is found. If I navigate to the case list I can see a whole bunch of mostly old looking bugs but if I click on any of them the system still doesn’t find anything. So how do *I*, or any other non-Ansca person, track bugs? How can I tell if a bug I have is a duplicate bug? How can I search for related bugs that might help me identify if my issue is my own fault or potentially a bug in Corona?

Needless to say, from my perspective as a customer, this whole bug submit process is opaque and mostly useless. This might explain why so many of the bug complaints on these forums don’t have an associated actual bug report. [import]uid: 9422 topic_id: 3208 reply_id: 110654[/import]

I would suggest that the process of refining code to a simple, reproducible version can be quite cathartic and often uncover the underlying issue, that the problem is not in the technology but the developer’s initial code.

There’s a story about a university which had a teddy bear students would have to explain their problems to before being able to book an appointment with their tutors. It cut down appointments by 80%. [import]uid: 8271 topic_id: 3208 reply_id: 110660[/import]

@horacebury

While I agree with your notion (and practically all of my bugs have been of my own making) I still think the requirement to submit code with a bug report is too stringent. Especially since, in this particular case, Walter asked me to submit a bug so “that way we (Ansca) can track this”. There have been numerous code examples posted to this Teddy Bear, er, thread to help illustrate this bug, and Walter himself says he has been looking at it, so it’s not clear to me how submitting a new bug report with more code will augment the process.

The fact that I can’t effectively search the bug base to even find out if someone else has already done the hard work and submitted some sample code is frustrating. I’m just saying that, as a system to report and track issues, the current system Ansca uses is lacking from an end-user’s perspective, imo. Unless the ultimate goal is NOT to identify issues but to cut down on the number of bugs submitted, in which case the system is working perfectly.

I’m sure it would be annoying to have to wade through 100 bug reports of “ragdolls don’t work fix it!!!” to find the one with some useful code or details. But at least Ansca would then know that 100 people are having the same bad experience. As it is now those 100 people are suffering in silence, have given up, or simply moved on to another platform, and Corona is tainted with the reputation of having a “flaky” Box2D implementation whether or not it is deserved. [import]uid: 9422 topic_id: 3208 reply_id: 110674[/import]

@XenonBL, I’m trying to help here, but if you don’t attach sample code there’s not much I can do.

And just to put this in perspective, even Apple’s own bug base is significantly worse and even less transparent — yet they require test cases to be submitted too!

There are many reasons we need the test case. Given how complex physics is, the reasons are only magnified. Even Erin Catto (the creator of Box2D) asks for test cases — if he needs it to understand what’s going on, we’re completely handicapped if you don’t give us anything.

Of all the examples we have received, they have consistently used the gameUI.lua touch listener to attach a touch joint to move the ragdoll.

And as I described above, reducing the maxForce resolves the issue, putting Corona’s joint stability on par with other ragdolls we’ve seen on other Box2D implementations.

You mentioned you’re doing something different, so naturally we’d need to see the code.
[import]uid: 26 topic_id: 3208 reply_id: 110757[/import]

Believe me, I do understand the importance of test cases. If I could pull out a simple example from my code, even if it took me a few hours, I would. But my game is quite far along, (over 50K lines of code spread across 60 or so lua files) and it would not be a trivial task for me. It also wouldn’t be a great illustration of the problem since, as I mentioned above, I’ve actually done a lot to minimized most (but not all) of the joint dismembering.

But the title of this thread is “Pivot Joints and apparent elasticity”, and that’s what I hoped was being looked at. The problem as I understood it was never the touch joint used to move the ragdoll. As far as I know I’m constructing my ragdoll the same way everyone else does, using pivot joints. And pivot joints don’t use the maxForce property. Maybe we’re talking about two different things.

Walter, if you could post your fixed ragdoll example code then we could all see what you are talking about, and I would then try my best to break it to show you what I’m talking about :wink:
As far as Apple’s bug base, it sounds pretty awful too. Even if it’s the best of the worst, I know (and hope) Ansca can do it better. Take or leave my criticism for whatever it’s worth, I’m just trying to give you my honest opinion because I want Ansca/Corona to succeed.
[import]uid: 9422 topic_id: 3208 reply_id: 110771[/import]

@XenonBL

I 100% agree with you. I submitted a bug report and I even wrote some sample code demonstrating this problem. I got an email back saying my code was incomplete and therefore my bug report would essentially be ignored. How complete should my code be? I can see how a sample of the relevant code might be helpful but REQUIRING a fully functioning app is it a bit silly.

And in such a prolific instance as this we as customers really shouldn’t be the ones to provide code. I pay you Ansca, can YOU please provide ME with code? Provide me with the code of a fully functioning ragdoll and I’ll gladly drop this issue forever. I paid for Corona in part because I believed things like ragdolls, vehicles (rotating wheels, shocks etc), and even just simple joints were possible. Since Corona has joints I assumed they would work before I paid for it. Now I find that not to be the case. I’m glad there’s an outlet for us customers to report bugs, but really we deserve code that is bug free in the first place. I know that’s not 100% realistic but its really on Ansca to find and clean up bugs, not on us their clients. If we complain about a bug on a forum without making a formal bug report than I think its a Ansca staff member’s duty to go make a bug report, not the customer’s. That’s especially true in this instance, with such a major and widespread issue. We don’t need to provide code that doesn’t work, Ansca needs to give us code that does. Show us a ragdoll that works properly, that doesn’t get caught up on objects, and that doesn’t fly apart for no apparent reason. I understand that physics is complicated and that this is a complicated issue. But that shouldn’t matter: maybe there are 100 ways to do it wrong, please show us just one way to do it right. Why should we submit buggy code that we already know doesn’t work when what we all really want is a demonstration of how to do it properly. Of course I doubt any member of Ansca’s staff could make a properly functioning ragdoll since the “one right way” doesn’t even exist. Its impossible to make a working rag-doll (I would LOVE to be proven wrong) with Corona as it currently stands.

Don’t ask us for any more code–we are the customers and WE are asking for you to show us working code. I can’t speak for everyone but I imagine everyone whose commented on this forum will be forever satisfied if we can just see some code that actually DOES work (aka doesn’t get caught up on other objects, fly around the screen, stretch apart etc). Thank you. [import]uid: 94309 topic_id: 3208 reply_id: 110773[/import]

Agree 100% with iqsoup.

Has no one at Ansca ever used the physics engine except to drop crates from the sky?

I stopped paying attention to these physics related threads because I got tired of the same thing over and over, but my inbox was blowing up so I had to check it out. I see the standard operating procedure for anything physics related is still in place: Ignore, Delay, Divert.
[import]uid: 40137 topic_id: 3208 reply_id: 110778[/import]

@iqsoup,

Please pardon if I state anything grossly incorrect in the following response. I read a vast amount of forum posts every day, and it’s possible that I confuse which things have been commented upon and which haven’t.

Was it said that Ansca requires an entire functioning app to judge a test case? I don’t believe so, but again, I could be wrong. I understand it’s not always easy… maybe even impossible… to pull out just one “segment” of a massive app and demonstrate what’s going wrong. But in the case of physics (which I have worked with considerably, in Corona and in two other SDKs), I would think it’s usually possible to pull out at least the body construction(s) and demonstrate what is happening.

Even if the truncated portion doesn’t represent your exact scenario, if it provides some sense of what’s going on, it helps Ansca figure out where the problem might lie, versus “shooting simulated fish in a simulated barrel”. You realize as well as anybody how one TINY little change to one SMALL little value or setting in the physics setup can vastly change the outcome.

In the past few days, I have seen Walter, the CEO, personally addressing this issue, primarily in this thread. I realize you’re frustrated and rightfully so, but I would say it’s fairly impressive to see the CEO of a tech company communicating with the community at all, and then to be addressing an issue personally and providing extensive explanation of his progress… well that’s a big step up. :slight_smile:

Thus, it appears that this issue truly IS under investigation, Ansca isn’t just claiming so. Some new discoveries regarding mass and body types and force have, as far as I can tell, narrowed it all down somewhat.

I believe… and again, I mean no disrespect… that it’s not Ansca’s job to write code for me or anybody else. I can’t, for example, ask them to write fully-functioning code for a “runner” game because that’s the kind of game I want to create. Jonathan Beebe, among countless others – indie developers and Ansca staff combined – have donated their time and worthy efforts to write alot of sample code and even fully-working game templates. I understand that a rag-doll is not among these, although for your sake, I truly wish it were.

I guess my advice is: hang tight for a bit longer on this. I realize it’s already been forever and beyond forever, but the investigation (and hopefully the solution) is sincerely underway.

Regards,
Brent Sorrentino
Ignis Design [import]uid: 9747 topic_id: 3208 reply_id: 110779[/import]

I’m going to ditto XenonBL’s post. Looks like there are 2 issues here, ragdoll touch joints AND ragdoll pivot joints.

I read Erin Catto’ paper and it gave some excellent pointers on both issues and known problems. So I would recommend reading that as it is from an expert at this topic.

Speaking specifically about pivot joints, there’s no maxforce to change so that solution is out. Tried the circles in between the joints but that’s doesn’t solve it (maybe if it was a snake slitherin over obstacles like that other example). Still trying to come up with something clever, until then I’m hopeful that some tweaks to Ansca’s code will help. [import]uid: 40033 topic_id: 3208 reply_id: 110782[/import]

"In the past few days, I have seen Walter, the CEO, personally addressing this issue, primarily in this thread. I realize you’re frustrated and rightfully so, but I would say it’s fairly impressive to see the CEO of a tech company communicating with the community at all, and then to be addressing an issue personally and providing extensive explanation of his progress…"

@Brent - With all due respect, you and/or Ansca can’t have it both ways and expect us to swallow it. You can’t praise Walter on the one hand for being the CEO and having the generosity to communicate to us peons, while on the other hand have Walter himself admitting that he – the CEO – is the one staying up late on weekends to figure this out. Certainly the CEO can find someone qualified to tackle this.

I suspect that Walter might be the only one at Ansca who understands the Corona implementation of Box2D since he’s the one who wrote it. IF that’s the case – as CEO – he needs to realize that that arrangement is not working, as he understandably has many other duties to attend to.

Ansca’s focus on things like storyboard and level editors and even Mac apps compared to something as basic as the physics engine is troubling, especially when there were already viable 3rd party implementations of the first two. If one tenth of the time that’s been dedicated to storyboard was spent on the physics engine this thread would’ve been dead long ago.

No one commenting here wants Ansca to fail. We will continue to wait and wait and wait for Ansca to fix the physics related issues. We will wait until the day we decide not to wait any longer. Some have already made that decision. [import]uid: 40137 topic_id: 3208 reply_id: 110785[/import]

@RestlessNativeGames,

I’m not asking you to “swallow” anything; I merely pointed out that the issue is clearly under investigation by Walter. Whether you agree or not that he’s the correct person for the task is somewhat irrelevant.

I have been pushing for improved physics for quite some time, since it’s one of the weaker areas of Corona in my own personal opinion. I will continue to push for it.

You might not agree with the priorities of Ansca. I’d ask you to find 2 developers… any 2… who directly and completely agree on the priorities. Just because you consider Storyboard or Level Editor a low priority doesn’t mean that others do. While Director was, and still is, a perfectly viable alternative, Ansca could NOT support it as a 3rd-party tool, and yet many developers needed an official, supported solution for scene management (Director, after all, could not realistically be supported by Mr. Rauber alone). As for the Level Editor, that has been on the wish list for *months* in the eyes of MANY developers who found the 3rd-party alternatives lacking or outright incapable. I actually wrote my own basic level editor, from scratch, because the 3rd-party tools weren’t sufficient or stable enough.

Anyway, if you don’t wish to receive further e-mails from this thread, please use the “unsubscribe” feature in your account settings.

Brent [import]uid: 9747 topic_id: 3208 reply_id: 110787[/import]

"Anyway, if you don’t wish to receive further e-mails from this thread, please use the “unsubscribe” feature in your account settings."

I see… the badge means you’re in charge here.

Forgive me if I offended you. It was not my intention. I mistook your actual honest opinion as simply a regurgitation of the standard PR crap.

Yes, my opinions ARE irrelevant. As are yours. [import]uid: 40137 topic_id: 3208 reply_id: 110790[/import]

Interesting semantics @RestlessNativeGames.

"With all due respect" (followed by a rather disrespectful rant)
"Forgive me if I offended you." (preceded by something intentionally offensive)

But I’m not going to get into a war of words with you. I just finished one of those with another disgruntled developer, who will remain nameless here. It was pointless, self-destructive, and I have better things to do. Part of my “job” as an Ambassador is to help developers with issues, coding, and basic support. I do this as a volunteer, with no compensation and under no insistence from Ansca.

Again, since you have nothing further to add to this topic except to ruffle feathers, I suggest you unsubscribe from it. You too (I would hope) have better things to do.

Brent

P.S. - in truth, my opinions are relevant and reach the proper channels; but don’t worry about it, it’s not your concern. :slight_smile: [import]uid: 9747 topic_id: 3208 reply_id: 110791[/import]