Weak constraint: btMultiBody to btRigidBody

Post Reply
poptopoverride
Posts: 3
Joined: Fri Oct 21, 2016 1:06 am

Weak constraint: btMultiBody to btRigidBody

Post by poptopoverride »

Test scene: a spherical rigid body (angular factor 0,0,1, mass 400) attached to a multibody using a btMultiBodyFixedConstraint (links of mass 100). Applying forces directly to the sphere, I intend for the sphere to be 'leashed' to the chain in the same way as the links of the multibody.

I've gone ahead and implemented the chain multibody that was created in the example (MultiDofDemo) and it was a clear step up from a chain of constraints I was using before (chain links not stretched/bouncing upon large forces). However, it seems that the constraint between the rigid body and multibody has a less 'hard' relationship in that it appears the constraint pulls the sphere towards it slowly, being pulled even faster if I increase the m_maxAppliedImpulse on the object. I don't see much functionality for the multibody constraints on this issue (such as stiffness maybe?). I'm not aiming for physical accuracy, so breaking some fundamentals to achieve a hard chain would be fine with me.

Chain and fixed constraint while within reach of the chain: ( http://i.imgur.com/xeshhCJ.png ) working as intended.
Chain and fixed constraint while pushing out of reach of the chain: ( http://i.imgur.com/mxOWSUD.png ) chain working as intended, rigid body being affected weakly.

Does anyone have a suggestion on implementing this properly? I'm open to switching to non multibodies as well if that's the better approach.
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Weak constraint: btMultiBody to btRigidBody

Post by benelot »

Hello,

One question upfront. Why is the sphere not direct part of the multibody but a rigidbody? The constraint between a multbody and a rigidbody is not the same constrainttype as between two multibody linkers. It is just a normal rigidbody constraint that pulls parts into place with forces. That is why just can stretch it. Alternatively, you should be fine with a very high maximpulse, that should be very strong (well, to get a faster reaction to your pulling, you also need to increase your physics step). Another alternative is to constrain your object using simple math. Calculate the length of the chain, or radius of the chain constraining your sphere and stop the sphere cancelling all its velocity which moves it out of the radius (which is basically a projection of the linear velocity onto the radius tangent.)
poptopoverride
Posts: 3
Joined: Fri Oct 21, 2016 1:06 am

Re: Weak constraint: btMultiBody to btRigidBody

Post by poptopoverride »

Benelot:
Well, the sphere acts as an individual agent; able to grab and release the multibody. So I figured it made sense to keep it as a rigid body.
I've tried the maximpulse route, however it adds increasing jitteriness as it is increased. The custom constraint is probably the solution I was looking for. Is there a particular constraint resolution function that I should look into editing where I'd have control over the constraint velocities?
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Weak constraint: btMultiBody to btRigidBody

Post by benelot »

The constraint I was proposing would be entirely hand-made. Just take the origin of your chain and the center of the sphere and track the distance between the two in every physics step, then as it surpasses the max distance you intend it to have, you cancel out all distance increasing movement. You can run your custom constraint corrections every time the simulation ticks by using a simulation tick callback: http://www.bulletphysics.org/mediawiki- ... _Callbacks
poptopoverride
Posts: 3
Joined: Fri Oct 21, 2016 1:06 am

Re: Weak constraint: btMultiBody to btRigidBody

Post by poptopoverride »

benelot: Thanks for the infos
Custom constraint for limiting the distance works for preventing the gap between the two objects, however it doesn't appear there's much ability to affect the bottom link's collisionobject in the same way that I can with the rigid body. Currently, the position of the rigid body is being casted to the origin of the link, but for proper tugging I would need to be able to pull the link. Is there a way to 'push' the link in a similar manner as apply impulse, linear velocity, etc. moves rigid bodies?
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Weak constraint: btMultiBody to btRigidBody

Post by benelot »

I am not sure what you mean by pulling..you can easily pull a link via constraints such as it is done in the multibody dragging examples.
Post Reply