Sharing the same TriMesh object between multiple Nodes?


Is it ok to create one TriMesh and share that among multiple Nodes.  For example, lets say I had three Quads that represesented different types of asteroids for a 2D Asteroid type game.  For efficiency reasons, I would just want to construct the Quads once when the program loads (storing the 3 Quads in a Singleton type object), and create Nodes that simply contain the Quads during the actual construction of the Asteroid levels. (rather than rebuilding the Quads during the construction of each asteroid)…  Is there anything wrong with this approach?   

Also. does each Node name have to be unique?  What happens if it isn't? 



You can't do that… a spatial automatically detaches from a Node if you add it to another Node. The good news is, SharedMesh let's you do exactly what you want, take a look at it…

Node names do not have to be unique.

Thanks!  I'll try SharedMesh.  Also, why would someone use a SharedNode rather than a SharedMesh (any good cases)?

SharedNode, at the time you create it, simply makes SharedMeshes from all the childeren of the target Node. So it's not much of a difference (just easier if you have a whole Node you want to share).