[resolved] How do I stop revolute joints coming apart?

0 favourites
  • 10 posts
  • So I'm just dabbling in physics.. using the ragdoll sample project. I find my doll's joints become 'disjoint' after collisions with other physics-enabled objects. These are fairly low speed impacts. I have read about how the physics model can become 'unstable' with unrealistic forces/velocities. I'm just surprised it's so easy to pull apart these types of joints. For example my doll's head seems to be the first part to become pulled away from its original position when it gets 'caught' on or hit by, other physics objects. Maybe that's just because it's the largest single part (most mass). Any tips? Will check back in the morning Thanks.

    PS I have read the maual and searched the forum, found a few useful tidbits, but not this.

  • There are some good lessons in this thread. Hope this helps fix your snag...

  • Edit2: ok I just saw this

    Edit: added capx. Bash the ragdoll around to see his head joint become dislodged. Disable the 'on collision' checks to see the difference.

    Thanks for taking the time and pointing me to that thread.

    I was writing up a response, to say that I think he and I had different issues (my sprites are not stretched, image points seem all ok, etc.) then I thought I'd put together a minimal capx. While I was doing that, I think I found the issue..

    When my ragdoll was hitting another physics object, I would change frame of the 'head' object, say from 0 to 1 (it only has three frames). All frames are the same size.

    So I would do

    On collision:

    ->change frame to 1

    ->wait 1.0 seconds

    ->change frame to 0

    Removing the above for the sample capx seems to keep my ragdoll together. Leaving the Wait on its own is fine (unsurprisingly).

    It seems changing frames is enough to screw up the physics processing. Is this reasonable?

  • Ashley could we please have a mention of this somewhere in the manual, maybe just as a note? I think it would save others hours of frustration. Unless it's somewhere I haven't seen.

  • The same thing happens if you use a Timer to change the frame back to 0, so the problem is something associated with fast moving / dynamic physics objects changing their joint reference positions when they change frame (I think...).

    codah, if you create another head sprite (non-physics) and pin it to the head physics object (make it invisible) then you can then change the image frame on the visible sprite for the effect you're after.

  • codah, if you create another head sprite (non-physics) and pin it to the head physics object (make it invisible) then you can then change the image frame on the visible sprite for the effect you're after.

    Thanks, already done and working fine thanks for the help! But yea it's a known condition apparently for the last 100 releases (intentional and not to be fixed AFAIK).

  • !! 100 releases !!

    I am a little disappointed in the physics engine in C2 because the rest of the game engine is simply brilliant. But stuff like this makes game making using physics quite frustrating (and impossible).

  • !! 100 releases !!

    I am a little disappointed in the physics engine in C2 because the rest of the game engine is simply brilliant. But stuff like this makes game making using physics quite frustrating (and impossible).

    Yea I thought I was looking at a bug report for 178, but it was 78

    I'm only going to use physics for simple things.

  • The problem is changing animation frames causes the physics body to be destroyed and a new one created in its place, and doing that prevents forces and joints from working normally. I can't explain why this is, it seems to be a result of the box2D physics engine, and I don't know what we could change to prevent it.

    Don't animate or resize any physics objects - if you need to, use invisible static objects with the physics behavior and place any animated/resizing objects on top of it. This is mentioned in the first physics tutorial.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The problem is changing animation frames causes the physics body to be destroyed and a new one created in its place, and doing that prevents forces and joints from working normally. I can't explain why this is, it seems to be a result of the box2D physics engine, and I don't know what we could change to prevent it.

    Don't animate or resize any physics objects - if you need to, use invisible static objects with the physics behavior and place any animated/resizing objects on top of it. This is mentioned in the first physics tutorial.

    Ashley I implemened the technique you mentioned just fine, once I knew the limitation. I cannot see this mentioned in the tutorial however. TBH it should be in the manual, but the tutorial would also be ok.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)