problem with RevoluteJoints exploding? (example attached)

Hi guys, I'm having a problem with my revoluteJoints exploding for seemingly no reason, has anyone had a problem similar to this?

http://www.freshcut.org/pd/pigdogTest.html

use the space key to activate the dogs helicopter then hover over the pigs to pick them up (yeah sounds surreal I know), the revolute joints explode more often than not (but not always) when you chain 2 pigs together (use Z and X to zoom in and out for a better view of the physics objects) when there's just 1 pig in the chain its not as often but still happens occasionally.

(you'll have to refresh the page once you've picked up the pigs once, sorry, early early code)

Anyone else come across this or found a fix (cheap and dirty hacks are fine, kind of time sensitive)
I didn't figure out how to make the attachment, but I'm guessing you have some light weight links between heavy objects. I suggest increasing the density of the links.

Also, you seem to have some jitter. Try to keep your physics lengths for your characters around 0.1-10 units. This is necessary so that b2_linearSlop is tuned correctly.

Do you have restitution set to zero on your characters?
hey thanks for the reply erin, to make the attachment hover the dogs tail on top of the pigs head, there's a basic collision detect round that area,
do you mean increase the density of the 2 bodies connected by the joint?
I'll check all the units but from memory everythings around the 0.5 - 1 scale
I was messing with the restitution before i uploaded, so I'm not sure if the version thats online is set to 0,

thanks again 🙂
Ok, I reproduced the problem.

Try making the density of the tail/limbs higher. You can also try a smaller time step and/or more iterations.
geeze for some reason i was running at 3 iterations?! I upped it to 10 and it seems a hell of a lot more stable, thanks erin sorry for wasting yer time
Hi,

I'm having the same problem with Revolute Joint breaking up as well. I'm using revolute joints to simulate cables by having many segments connected to each other by joints.

The problem with increasing the density of each segment is that it greatly increases the weight of the cable. In some cases I need to attach the cable to some objects that pulls with a constant force, so ideally I would like the cable to have as little weight as possible.

Is there any simple hack that could make the revolute joint unbreakable without increasing the density?

Thanks for the great work on the physics engine by the way!

Tommy

Edit:
Adding a before and after screenshot

before:
Image

after:
Image
freshcut: not problem, glad you resolve it.

Tommy: if you are worried about the weight of the links, you can try a number of things:

1. Don't increase the link density, but artificially increase the rotational inertia of the links:
Code:
float32 scale = 8.0f;
float32 invScale = 1.0f / scale;
linkBody->m_I *= scale;
linkBody->m_invI *= invScale;


2. Increase the density of the links, but try to counter the increased weight. Apply a force opposite to gravity each time step.
Code:
linkBody->ApplyForce(-0.95f * gravity);


3. Decrease your time step.
Thanks Eric, that worked like a charm!

I'm so happy now, been trying a lot of different ways to solve this but never thought of any of your solutions... shows you how much I know about physics 😉

Thanks again!
Tommy
freshcut, how are you make this jump model? I think about it, but i have no idea. Please give me some advice. For example, how you determine on witch surface object may jump?
hi rzr, the jump model isn't finished, but the basic is just
Code:
if (!jumping && someBody.m_contactList != null) {
   someBody.m_linearVelocity.y = -1000;
   jumping = true;
}
if (jumping && someBody.m_contactList != null) {
   jumping = false;
}


you get the idea
this isn't perfect as it responds to any collision so even if an objects hits you in the air you can then jump again.
but still depending on your game I'm sure you can work something out

Original thread: https://box2d.org/forum/viewtopic.php?t=471