Issues Attaching Bodies Together

uberglitch

25-05-2010 05:15:47

Hey folks,

I've seen the question posted a couple of times on this forum, but never with a concrete answer. I hope this problem is super basic and I just missed a tutorial.

I'm trying to connect some bodies together dynamically (i.e. the bodies are created and have their own Collisions separately) but sometimes they need to get glued/welded together. I tried using a CustomRigidJoint to connect them but they still ended up moving apart when hit with a force.

There's a few posts about using CompoundCollisions to maybe accomplish this but my search-fu is weak and I haven't been able to find a tutorial on how to use them. Could I store the original Body Collision, apply the CompoundCollision while it is needed, then revert back to the original Collision? Or is there something wrong with my joint?

Here is the MaterialPair Code I'm using if it helps:


// (Using MogreNewt) Set default material settings
default_material_pair.SetDefaultElasticity(1);
default_material_pair.SetDefaultSoftness(0.05f);
default_material_pair.SetDefaultFriction(1, 1);
default_material_pair.SetDefaultCollidable(1);
default_material_pair.SetContinuousCollisionMode(0);
default_material_pair.SetDefaultSurfaceThickness(20);


Thanks!