[ODE] Copying/Cloning Composite Objects

Tyler Streeter tylerstreeter at gmail.com
Fri Aug 5 07:55:23 MST 2005


In OPAL (http://opal.sf.net) we store a data structure within every
object that fully describes the object.  For example, a Solid (ODE
body + any number of offset geoms) contains a SolidData object.  Then
you can clone a Solid by saying:

newSolid->init(mySolid->getData());

For more complex things involving multiple Solids and Joints, we have
a Blueprint object.  Users can build a Blueprint by adding SolidData
and JointData objects to it, then instantiate the Blueprint (with an
arbitrary transform and scaling factor).  Also, Blueprints can be
loaded from XML files.

That's how we handled copying/cloning.  You can browse the source
here:  http://cvs.sourceforge.net/viewcvs.py/opal/

Hope that helps.

Tyler

On 8/5/05, Jaroslav Sinecky <jsinecky at tiscali.cz> wrote:
> I'm pretty sure, there are no cloning functions in ODE. As you say, it
> shouldn't be problem to write them using Get/Set functions + dGeomGetClass.
> Maybe someone has done it?
> 
> Eh ... actually the most simple way is just to call your creation routine
> more times ;-) It works nice for me but I understand it could not be a good
> solution for your scenario.
> 
> Cheers!
> Jaroslav
> 
> 
> > -----Original Message-----
> > From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf
> > Of john rieffel
> > Sent: Friday, August 05, 2005 4:09 AM
> > To: ode at q12.org
> > Subject: [ODE] Copying/Cloning Composite Objects
> >
> >
> > Hi Folks,
> >
> > I'm getting back into ODE after a brief sabbatical from hacking.
> > Here's my question:
> >
> > I've learned (thanks to matt hancher) how to create a single composite
> > object given a set of individual bodies, by using a dGeomTransform.
> > Now that I've created such a composite, I can place it in the world
> > and watch it behave, which is quite satisfying.
> >
> > Now I'd like to be able to "clone" said composite object.  For
> > instance, say that I've encapsulated a bunch of fobs into a "widget"
> > object, and now I'd like to place 10 geometrically identical such
> > widgets throughout the world - what's the best way to do this?
> >
> > Are there any utility functions or obvious shortcuts for how to make
> > copies of such a dGeomTransform?  Or, do I have to hand-write a
> > function which, given a target dGeomTransform, creates a new body in
> > the world (corresponding to the clone), copy the object's mass and
> > then copy each of the geoms to the clone, etc etc etc?
> >
> > Now that I've listed it all out it doesn't seem that bad after all,
> > but I get the impression that someone else must have come across this
> > problem (and solved it elegantly) - so I'd rather not repeat someone
> > else's work.
> >
> > Thanks,
> > John Rieffel
> >
> > _______________________________________________
> > ODE mailing list
> > ODE at q12.org
> > http://q12.org/mailman/listinfo/ode
> 
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>



More information about the ODE mailing list