[ODE] No Collision Composite Bodies.
Tristan McMillan
tmcmillan at tmiconsult.co.za
Mon Sep 18 08:11:01 MST 2006
Hi Guys
I've created a composite truck using two boxes and a single x
representing the trailer. Then I've created a ramp in ODE using a box
tilted at an angle.
Now when I drive into the block the composite truck penetrates the block
but the single box collides perfectly.
Does anyone know what my problem could be?
The sample code for the composite block is shown below:
const dReal* position;
mHorseBodyDetails.body = dBodyCreate(World);
dBodySetPosition( mHorseBodyDetails.body,mProperties.CG[0],mProperties.CG[1],mProperties.CG[2] );
dMass MassComponent1;
dMassSetZero(&mM);
dMass MassComponent2;
dMassSetZero(&MassComponent2);
///Point of cab centre relative to cg) //
dReal cabCentre[3];
cabCentre[0]=1.4322;
cabCentre[1]=0;
cabCentre[2]=0.875;
///Point of chassis relative to cg//
dReal chassisCentre[3];
chassisCentre[0]= -0.62;
chassisCentre[1]=0;
chassisCentre[2]= -0.375;
///Set the mass of each box///
dMassSetBox(&MassComponent1,DENSITY,2.108,2.5,1.85);
dMassSetBox(&MassComponent2,DENSITY,0.65,2.5,6.2 );
///Generate the transform///
mHorseBodyDetails.geom[0] = dCreateGeomTransform(0);
mHorseBodyDetails.geom[1] = dCreateGeomTransform(0);
///Set Cleanup on ///
dGeomTransformSetCleanup(mHorseBodyDetails.geom[0],1);
dGeomTransformSetCleanup(mHorseBodyDetails.geom[1],1);
///Create the geometry for each box 0 is cab, 1 is chassis//
mHorseGeom[0] = dCreateBox( 0, 2.108,2.5,1.85);
mHorseGeom[1] = dCreateBox(0,0.65,2.5,6.2); // create seperate second
box
///*Set the geometry transform to the struct//
dGeomTransformSetGeom(mHorseBodyDetails.geom[0],mHorseGeom[0]);
dGeomTransformSetGeom(mHorseBodyDetails.geom[1],mHorseGeom[1]);
//*set transform relationship///
dGeomSetPosition(mHorseGeom[0],cabCentre[0],cabCentre[1],cabCentre[2]);
dGeomSetPosition(mHorseGeom[1],chassisCentre[0],chassisCentre[1],chassisCentre[2]);
///Translate the mass from the cg(0,0,0) to each geom cg
dMassTranslate(&MassComponent1,cabCentre[0],cabCentre[1],cabCentre[2]);
dMassTranslate(&MassComponent2,chassisCentre[0],chassisCentre[1],chassisCentre[2]);
and in the simloop I use dSpaceCollide( sSpace, 0, CollisionCallback );
to check for the collisions.
Thanks
Tristan
More information about the ODE
mailing list