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.
'Welding' Objects Together
-
- Posts: 65
- Joined: Thu Mar 06, 2014 5:56 am
- Location: USA - Arizona
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: 'Welding' Objects Together
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.
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.
-
- Posts: 463
- Joined: Fri Nov 30, 2012 4:50 am
Re: 'Welding' Objects Together
Wouldn't that remove the independent collisions aspect? (video states objects should be able to move relative to each other if colliding)Erwin Coumans wrote:The best is to use a btCompoundShape and merge the bodies into a single btRigidBody.
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.
-
- Posts: 65
- Joined: Thu Mar 06, 2014 5:56 am
- Location: USA - Arizona
Re: 'Welding' Objects Together
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?
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?
-
- Posts: 463
- Joined: Fri Nov 30, 2012 4:50 am
Re: 'Welding' Objects Together
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 ).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?
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)