Posted by: flipvisual Mar 16 2007, 07:52 PM
Hi Guys
I
would like to create a new 3d world each time a user enters a section
of the website and as such I would like to completley destroy the
previous world. Any idea how this can be achieved?
Im using:
World3D.getInstance().addCamera(camera);
World3D.getInstance().setRootGroup(background);
createScene(background);
World3D.getInstance().render();
Thanks
Mark
Flip Visual
Posted by: Petit Mar 16 2007, 09:43 PM
QUOTE(flipvisual @ Mar 16 2007, 08:52 PM)

I
would like to create a new 3d world each time a user enters a section
of the website and as such I would like to completley destroy the
previous world. Any idea how this can be achieved?
Hi! Sounds like a Flash web site to me.
If so, you don't have to create new worlds or destroy old ones.
In a flash site one or more objects on the stage may link to other web pages or Flash movies ( SWF ).
This
simply means navigating in the "main" world ( e.g. clicking an object )
links to another world ( another swf ), which is loaded into the
browser. ( They probably doesn't have to be embedded in web pages.
What happens to the 'old' world?
Well it stops running, but is still stored in the browser cache.
If you close the browser, all your worlds are destroyed.
Oh, that sounds dangerous! Have no fear - only on the client side.
Disclaimer: This is how I see it. I haven't tested it but believe it works this way.
Posted by: flipvisual Mar 17 2007, 01:44 AM
Thanks
for your reply. But i think i may have not exlained myself correctly. I
am not loading any new swfs or directing anyone away. I just wish to
totally destroy the world so that if I create a new one and add objects
to it, it doesnt slow everything down. Atm I am using:
World3D.getInstance().getRootGroup().destroy();
World3D.getInstance().getRootGroup().remove();
World3D.getInstance().stop();
Thanks in advance
Posted by: kiroukou Mar 17 2007, 09:25 AM
Hi,
Yes doing destroy on the root group should work. and doing World3D.setRootGroup( null ) after that.
But I'm not sure that it is really removing every ressources from
memory. It would certainly not render aything, but I guess you'll have
some "small" memory leaks doing this.
This feature would be improved in the next revision.
Posted by: flipvisual Mar 17 2007, 11:39 AM
QUOTE(kiroukou @ Mar 17 2007, 09:25 AM)

Hi,
Yes doing destroy on the root group should work. and doing World3D.setRootGroup( null ) after that.
But I'm not sure that it is really removing every ressources from
memory. It would certainly not render aything, but I guess you'll have
some "small" memory leaks doing this.
This feature would be improved in the next revision.
Thanks guys. I solved the problem by using the code listed above and also using:
camera = World3D.getInstance().getCurrentCamera();
if (camera == undefined)
{
camera = new Camera3D(width, __world.screen);
World3D.getInstance().addCamera(camera);
}
else
{
camera.setFocal(width);
camera.setScreen(__world.screen);
}
Before I was adding a new camera each time which resulted in the slow down this ensures there is always only 1 camera.