realbasic-nug
[Top] [All Lists]

Re: Using Object3D.Clone?

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Using Object3D.Clone?
From: Lundstrom Design <ludesign at algonet dot se>
Date: Thu, 31 Jan 2002 14:15:58 +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
>--

I think you get a rounding error here. The picture object is not mapped
directly on the surface of the cube, which is the normal way to do it; it's
a separate object. Try placing the picture object at a small distance away
from the surface of the cube so that it floats slightly over the surface on
the visible side. Increase the distance if you already have a distance.


/Claes Lundström




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