Repositioning Weld Jointed objects

I have a body with a second body welded to it that acts as a counterweight, now I need to be able to move that counterweight to change the whole structure's centre of gravity, preferably without destroying/creating the joint each time I need it to move.

Is this possible (the non-create/destroy method)? Will it be added at some point in the future?

In case it helps, I'm working in the flash port (version 2.1A SVN).

Thanks.
The cost of destroying and recreating a joint is small.
Erin, you know the cost of everything, but the value of nothing! 😉

I'll just have to do that then, thanks 🙂
It is strange. Box2D is a rigid body engine. But so many people want it to be deformable. Joints that move, shapes that morph, collisions that vanish. I soon expect someone to ask for time that moves backwards.
Sounds greaT!

And if you could just get it to work for all situations from galactic to quantum that'd be super, thanks 😉
Couldn't you simply consider the attach points to be dependent variables rather than independent variables when solving the constraint?

Currently (AFAICT) the only reason that "everything is a rigid body" is that attach points are treated as if they're kinematic -- they have infinite mass and aren't affected by the solve.

If you figure out dC/dr (the gradient of the constraint function wrt the attach point's local position r), you can then correct r as part of the solve, making them fully dynamic. The same approach can be applied to collision geometry as well (which is really the same thing, contact points being just a different sort of "r"), but the collision detection problem becomes a nightmare.

Of course, once attach points are dynamic, you need to integrate them and drive their state with motors if you want to keep them in a certain position..
Wahooney wants to specify the position of the anchors according to some function I don't have access to and even if I did, it might not be differentiable (non-continuous).

If anchor points have state than does that mean they have mass? If so, why not use bodies for them? Then they need anchor points of their own, which might be bodies as well. Sounds like String Theory.
The offset of one object to another must be stored somewhere, right? I'm just looking for a way to change that offset. But since that will result in arse-ups, I'll just go ahead and do the whole destroy > create thing.
Erin Catto wrote:
Wahooney wants to specify the position of the anchors according to some function I don't have access to and even if I did, it might not be differentiable (non-continuous).

If anchor points have state than does that mean they have mass? If so, why not use bodies for them? Then they need anchor points of their own, which might be bodies as well. Sounds like String Theory.


Well, really you only need this one step of indirection, not a full infinite regress -- and it can be a particle rather than a rigid body.

Why should you need to know the function driving the attach point? Can't it remain hidden just like any other controller which supplies a target to a motor?

I don't understand the meaning of such a model -- what would the equivalent be in the real world? -- but in practice many desired movements in 2D games have no basis in reality.. and if you just move the attach points around kinematically (i.e destroy+recreate in new position), this is equivalent to using infinitely strong motors to drive them, which doesn't play well with the rest of the solver.

But I definitely do agree with you in principal, KISS.
raigan wrote:
Well, really you only need this one step of indirection, not a full infinite regress -- and it can be a particle rather than a rigid body.


So this particle has mass. Before we had:

bodyA-joint-bodyB

Now we have:

bodyA-joint-particle-joint-particle-joint-bodyB.

This doesn't seem like a good solution because it introduced unnecessary (artificial) degrees of freedom. By what principles shall he determine the mass of these particles? What are the joint types?

I think what really Wahooney wants is total control over the relative transform between two bodies. This could be accomplished by 3 DOF motor (2 translations and 1 rotation). This is basically a hybrid between the revolute joint and the friction joint.

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