If objects should be removed, remove them. In Away3D (not sure about
Away3DLite) you need to render after removing for them to be completely
removed. You also have to make sure that you remove strong references to the
object or event handlers with the object so that Flash can wipe it out during
garbage collection. Otherwise it'll keep the object in memory, even though its
been removed from your 3D scene.
On Wed, 27 Jan 2010 15:16:54 -0800, dp <[email protected]> wrote:
thanks pete, yeah that is better for this at the moment, but I was
thinking on a larger scale with many more objects that are not likely
to have their visibility switched that often, whether there would be
much gain in removing them more so?
cheers.
On Jan 27, 11:31 pm, Peter Kapelyan <[email protected]> wrote:
Try setting visible to false/true, is better than always removing adding the
same thing (if that's what you are doing)
-Pete
On Wed, Jan 27, 2010 at 5:07 PM, dp <[email protected]> wrote:
> I've been messing around with adding and removing objects depending on
> their proximity. However at the moment I suffer from constantly
> deteriorating performance, even though the total faces remain at a
> constant low level. I assume I'm not removing the objects correctly
> but don't know how else?
> Im pretty stuck. thanks!
> private function proximity():void
> {
> if ((obj.x >= oldX + 50 || obj.x <= oldX - 50) ||
> (obj.y >= oldY
> +50 || obj.y <= oldY -50))
> {
> for each ( var p:Plane in neighbors)
> {
> scene.removeChild(p);
> }
> neighbors = sdb.getAllNeighbors(obj.x,
> obj.y);
> for each ( p in neighbors)
> {
> scene.addChild(p)
> }
> oldX = obj.x;
> oldY = obj.y;
> }
> }
--
___________________
Actionscript 3.0 Flash 3D Graphics Engine
HTTP://AWAY3D.COM