realbasic-games
[Top] [All Lists]

Re: Cloning Trimesh

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Cloning Trimesh
From: Joseph Nastasi <joe at pyramiddesign dot us>
Date: Tue, 8 Nov 2005 11:19:18 -0500
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <14e78666b84e09bd1739f7ef5e4a01b6 at pyramiddesign dot us> <a0620070bbf967cab0ba4 at [10 dot 0 dot 1 dot 4]>

On Nov 8, 2005, at 11:06 AM, Joseph J. Strout wrote:

At 10:40 AM -0500 11/8/05, Joseph Nastasi wrote:

So, I built  a trimesh that I need to replicate. Can I clone it?

Yes, though it takes a few steps. Each of the group accessor classes (VectorList, TriangleList, and so on) has a Copy method. 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).

Ah, I knew there had to be a way.


I tried to cast the trimesh as an Object3D and use the clone method, but it said the cast was illegal.

That's right. Object3D and TriMesh both derive from Element3D; they are peers.

Duh, parent-child not peers, get it!

Thanks!

--
Joseph Nastasi
Pyramid Design - a software development firm
http://www.pyramiddesign.us
Voice 609 601-0814      Fax 609 601-0815
Products:
A-OK! Spacecraft Simulation System - http://aok.pyramiddesign.us
A-OK! The Wings of Mercury http://www.aokwom.com
FTP Suite for REALbasic - http://ftpsuite.pyramiddesign.us
Columnist for REALbasic Developer Magazine
Proud Sponsors of REALbasic Olympics 2005




_______________________________________________
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>