realbasic-nug
[Top] [All Lists]

Using Object3D.Clone?

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Using Object3D.Clone?
From: Ola Arwidsson <olabandola at mac dot com>
Date: Thu, 31 Jan 2002 13:24:30 +0100
I want to create a lot of small cubes with textures, (like dice) and put them on a floor in my Rb3DSpace. Now I create each cube by making an new object-from-pict for every side in the cube, then putting all of these together in a "cubeGroup". I then move this group, and append it to the Rb3DSpace.Objects.

For the next cube I do the same, but since they are exactly equal, I have tried to use the Clone method to reduce memory use. In my case the most convenient would would be

secondCube= new Group3D
secondcube= firstCube.Clone
secondCube.MoveForward..../ Roll / Yaw

Apparently Clone cannot be done for a group ("no such method" error), so I tried to clone each individual side in the cube, like

secondCube= new Group3D
secondCube.Append firstCube.Item(0).Clone // copy side 1
secondCube.Append firstCube.Item(0).Clone // copy side 2
etc.

This way I get a cube, but the textures are all looking very strange, often only part of each texture is drawn.

So what is the correct way to use Clone?
Is guess there are much more efficient ways to create a cube?

Ola
--


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