realbasic-games
[Top] [All Lists]

Re: Clone

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Clone
From: "Craig M." <FishyRB at 98115 dot net>
Date: Sat, 9 Dec 2006 23:42:06 -0800
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <536c96bc02ef2c952568ee7f8ae31cce at 98115 dot net> <43A3F22F-4206-4AAC-BE0B-219CD2C9F4F8 at mindspring dot com>
I was hoping to avoid reimporting everything, but it works fine as long as I don't reimport the file every-time. I just save the file to a string and use that, its much faster (This is still rebuilding, but not really reimporting). It works great. Now I have colored chunks in my explosions!
Thanks for the tips!

On Dec 9, 2006, at 4:42 PM, Jeff Quan wrote:
That's how cloning works.

If your model has only one trimesh in it, (to quote Joe Strout:)
"So, to clone a TriMesh, you would make a new TriMesh, set its number of vertices and triangles and such to the same as your original, and then call Copy on the VertexPositions, VertexNormals, Triangles, VertexColors (if applicable), and VertexUVs (ditto)."
Now you can change the Material on that Trimesh.

Another way you can make a copy is to reload the model each time you need a new instance and then change that instance's material (or materials if you have several textures in your model) after loading. This is done for Zombies (source at: http://www.codenautics.com/zombies).

So in both cases, you'd need to create a New Object3D for each copy, thus ensuring that they don't have any vertices and materials in common. Note that changing materials on an object can be slow.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>