Page 1 of 1

SOLVED WeldJoint problem

Posted: Thu Feb 13, 2014 12:06 am
by sergiusz308
Hello Norbo, I came across a little teaser with weldjoint in my tanky project.

I got box entity, atop tank hull, which is a compound body, joined together by a weld joint.

Red arrow points to that box. When simulation begins box start to wabble with increasing rate, throwing around whole tank as a result.

Box mass is 1, compound body mass is 20.

I also added collision rule no broad phase for the box and tank hull.

At the same time I have another entity - cylinder, atop convexhull (tank turret) - Purple arrow. These are joined by weld too and it works as expected - cylinder firmly sits on the turret, no oddities observed.
weldjoint.jpg
weldjoint.jpg (25.63 KiB) Viewed 6774 times
Both welds created with a default constructor, which takes two entities as parameters.

What I'm possibly doing wrong here?

Thanks,
S.

Re: WeldJoint problem

Posted: Thu Feb 13, 2014 12:40 am
by Norbo
By default, the WeldJoint creates an anchor for the ball socket joint at the midpoint between the two connected objects' positions. In this case, that midpoint will be quite distant from the tiny box relative to the box's inertia tensor. In effect, the box is on the end of a very long pole.

Moving the anchor closer to the box or just to the box's position should stabilize it. (Really, the WeldJoint should take an anchor in the constructor. The automatic guess causes this sort of issue more often than not.)

However...
When simulation begins box start to wabble with increasing rate, throwing around whole tank as a result.

Box mass is 1, compound body mass is 20.
Oscillating enough to make the whole tank move significantly is pretty odd. Usually, getting that large of an oscillation would require some combination of long time step duration, low iteration count, or over-rigid constraints with a hard simulation.

Re: WeldJoint problem

Posted: Thu Feb 13, 2014 10:43 pm
by sergiusz308
Thanks, case solved.