SOLVED WeldJoint problem

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
sergiusz308
Posts: 49
Joined: Mon Oct 08, 2012 4:57 pm

SOLVED WeldJoint problem

Post 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 3472 times
Both welds created with a default constructor, which takes two entities as parameters.

What I'm possibly doing wrong here?

Thanks,
S.
Last edited by sergiusz308 on Thu Feb 13, 2014 10:43 pm, edited 1 time in total.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: WeldJoint problem

Post 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.
sergiusz308
Posts: 49
Joined: Mon Oct 08, 2012 4:57 pm

Re: WeldJoint problem

Post by sergiusz308 »

Thanks, case solved.
Post Reply