Make weld joints less rigid, more wobbly

Hi there!

Are there any tips to make weld joints less rigid and more wobbly?

I am trying to construct a tree by welding a few triangles together. I’d like the tree to bend and then “snap back” to it’s original upright position when hit by other objects; but the weld joints are simply too rigid and they don’t really give much leeway for the bodies to move.

I tried using pivot joints and limiting the rotation limits, but this results in a floppy tree - it doesn’t stand up straight - and if you manually position it to be straight, it doesn’t “snap back” after it collides with another body.

I’ve tried a few techniques already; such as making the top triangles on the tree less dense than the bottom triangles, but it didn’t really change it noticeably at all.

I’ve tried faffing about with motortorque and lengths and the other built-in attributes of joints, but none of them seem to apply to weld joints…?

Anyone got any ideas on making weld joints more wobbly? [import]uid: 144339 topic_id: 28979 reply_id: 328979[/import]

Hi,
Weld joints aren’t meant to provide any flexibility as you describe. Occasionally they do, but by Box2D principles this isn’t normal or expected behavior when using weld joints, and so any occurences of the weld joint bending could result in the body parts breaking apart (unlikely but possible under extreme circumstances). Weld joints don’t accept any further parameters either.

The pivot joint method with rotation limits is theoretically still your best bet. But it will be difficult to make “rubber trees” as you describe, that snap back to their original shape.

I think there is one other joint type which lets you join two bodies at a different point on each body (versus the pivot joint which is like driving a nail right through that rotational point). I can’t remember which type it is (piston?) but I think it allows for rotational limits on each vertex end.

One possible but fairly convoluted workaround would be to “chain” your tree top to outlying floating invisible anchor points. These “chains” would be flexible distance joints or similar. Basically, you have 5 or more different stretchy bands pulling on the tree from different exterior points, and they would pull the tree (joined with pivot joints) back to its basic original state. But wow, it would be really complicated to set up and get all off those opposing force levels correct… and even then it might not work as you envision!

Best of luck, this is a daunting task for most 2D physics engines. :slight_smile:

Brent Sorrentino

[import]uid: 9747 topic_id: 28979 reply_id: 116643[/import]

I know the weld joints aren’t specifically designed for the flexibility; but the fact that they DO exhibit such behaviour gave me an inkling that it could be exploited somehow to provide that functionality.

As for your suggestion with anchoring it to invisible distance joints; I’d imagine that could probably work…very convoluted tho! XD

I’d imagine it’d probably be easier to create the floppy pivot tree, and have a function that; whenever the joints reach their rotation limit, to apply a small force to the bodies in the opposite direction - THEN decrease the rotation limit so that when the joints reach the other - now smaller rotation limit - apply the force again in the opposite direction and decrease the limit again - and repeat until the limit is at the “upright” position (if that description made any sense)

A bit hax, but I’d imagine you could probably pull it off in an update loop just calling a single function with different arguments to the direction of the forces and limits…

I might give that a shot - if it works, I’ll post some sample code so that others can get an idea how to do it.

Until then - anyone else ever implemented a jointed tree? [import]uid: 144339 topic_id: 28979 reply_id: 116795[/import]