www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: hytparadisee on June 14, 2007, 08:39:02 pm

Title: Make a complete clone of an Object3D
Post by: hytparadisee on June 14, 2007, 08:39:02 pm
Is it possible to clone an Object3D that is fully independent from the source object (don't share mesh etc.)? I want it cloned to the extent that it looks like loading the object twice from the model file?
Title: Re: Make a complete clone of an Object3D
Post by: EgonOlsen on June 14, 2007, 11:37:48 pm
You may get the mesh of the clone, clone it and set it again. That way, they don't share the same mesh.
Title: Re: Make a complete clone of an Object3D
Post by: hytparadisee on June 15, 2007, 04:47:57 am
Thanks, the cloning works. But it doesn't seem to reset the location/orientation of the object. I know that's not required. Just want to ask how to properly reset the translation/origin/orientation of a cloned object.
Title: Re: Make a complete clone of an Object3D
Post by: hytparadisee on June 15, 2007, 05:18:20 am
Arrrgghh. What a misconception i've made.

LOL, i mixed up the Object3D.translate() with the Node.setLocalTranslation() in jME. Object3D.translate() is actually doing the offset right?
Title: Re: Make a complete clone of an Object3D
Post by: EgonOlsen on June 15, 2007, 08:59:10 am
Actually yes. But it depends a little bit on how you define offset. There also a setOrigin() which does basically the same as translate() but doesn't have an influence on child objects where translate() has.
Title: Re: Make a complete clone of an Object3D
Post by: Kearnan on October 09, 2007, 01:31:23 am
This looks like the best place to post this question, it's of a similar topic:

Question: Is there a better way to clone?

Title: Re: Make a complete clone of an Object3D
Post by: Kearnan on October 10, 2007, 02:41:52 am
Err, nevermind.  Lame question.  I can just check to see if I've already loaded it, copy the Mesh and go from there.  I don't know why that seemed too obscure yesterday.