Page 1 of 1

'Welding' Objects Together

Posted: Wed Oct 01, 2014 1:20 am
by KKlouzal
I'm trying to essentially parent two objects without actually parenting them since I've read that two dynamic objects can't/shouldn't be parented together.

I've created a quick video visualizing my question along with much more detailed audio explanation.
https://www.youtube.com/watch?v=uSgdZnB5zDM

Basically I'm trying to figure out how to constrain two or more objects together over an arbitrary amount of distance so that they move and rotate as one.

Re: 'Welding' Objects Together

Posted: Thu Oct 02, 2014 2:42 pm
by Erwin Coumans
The best is to use a btCompoundShape and merge the bodies into a single btRigidBody.

Alternatively a btMultiBody with fixed joined could be used, available in the next release, but I wouldn't go that route, just use a single btRigidBody and btCompoundShape.

Re: 'Welding' Objects Together

Posted: Fri Oct 03, 2014 2:23 am
by Basroil
Erwin Coumans wrote:The best is to use a btCompoundShape and merge the bodies into a single btRigidBody.
Wouldn't that remove the independent collisions aspect? (video states objects should be able to move relative to each other if colliding)


If you want somewhat squishy constraints, why not just 6dof joint them together with a joint offset to be between them and non-infinite strength? Under normal conditions they would act as one, but if a sufficient force is applied (like that from collisions or if an object is wedged between them), they would have some relative movement. Not perfect, and might have some issues to work out, but it's easy enough to implement if you check the constraints demo.

Re: 'Welding' Objects Together

Posted: Fri Oct 03, 2014 11:28 am
by KKlouzal
I already assumed I could use a btCompoundShape but hoped to avoid that route. If you can specify a distance between the joints on a 6Dof constraint that might be exactly what I was looking for, I'll check the constraint demo again.

As a side note, it looks like the 6Dof constraint can do everything all the other constraints can? And then some?

EDIT:
I don't see anywhere in the btGeneric6DofConstraint source about setJointOffset or getJoint or anything like that. What am I missing here?

Re: 'Welding' Objects Together

Posted: Fri Oct 03, 2014 2:07 pm
by Basroil
KKlouzal wrote: EDIT:
I don't see anywhere in the btGeneric6DofConstraint source about setJointOffset or getJoint or anything like that. What am I missing here?
You can move things around by sending reference frames (frameInA, frameInB) other than (0,0,0) position. It can get very confusing to set them up in arbitrary orientation manually, so if you do it first get the world transform of the components and then project the frame to the halfway point between the two objects, and then convert that point from world transforms back to local ones. You only do that conversion once while setting up the joint, so don't worry if it seems like it's inefficient (unless you're making tons of joints ).

6dof can move in all 6dofs, while the spring version makes the joints softer, so it can move in more directions than any other joint, but for that very reason it's not the best in all cases (in robots I find that hinge joints tend to work better than 6dof based hinge joints)