Is there a sample code for using GeomTransform class?

Hello,

Can anyone provide a sample code for using GeomTransform class?
Because I find “ODE documentation” hard to completely understand.

P.S: It will be good if the sample code demonstrates how to attach multiple geoms to one body by using GeomTransform and
how to position the geoms in a body correctly.

Best regards,
Erke.

Well this is what I came up with:


GeomBox under = new GeomBox(length,width,thickness);
chassis = new Body("chassis",world);
GeomTransform gunder =  new GeomTransform("gunder");
gunder.setEncapsulatedGeom(under);
under.setPosition(0,0,2);
chassis.addGeom(gunder);

This does seem to work (i.e. compiles and the box is 2 heigher, also works when I add more geomotry), but it falls trought the ground I made :frowning: don’t know why

This seems to work:


GeomBox under = new GeomBox(length,width,thickness);
GeomBox left = new GeomBox(length,thickness,height);
GeomBox right = new GeomBox(length,thickness,height);
chassis = new Body("chassis",world,under);
GeomTransform gleft =  new GeomTransform("gleft");
gleft.setEncapsulatedGeom(left);
GeomTransform gright =  new GeomTransform("gright");
gright.setEncapsulatedGeom(right);
chassis.addGeom(gleft);
chassis.addGeom(gright);
		
left.setPosition(0,width/2-thickness/2,0);
right.setPosition(0,-width/2+thickness/2,0);
			
space.addBodyGeoms(chassis);
chassis.setPosition(x,y,z-height+thickness);
chassis.adjustMass(2f);

I believe it does NOT work when you ONLY add encapsulated bodies. If you add the first geom normally, and then the encapsulated it does work.