Object3D IDs and Names

Started by quixote_arg, March 27, 2006, 08:05:55 PM

Previous topic - Next topic

quixote_arg

Hi, I'm doing a simple 3D viewer, based on the FPS demo.

The player can throw a ball, and if the ball hits something relevant in the world, something happens. This is done as an Applet.

The first time everything goes well, but if I reload the page, object ID's and names change, so the code that checks if the ball has hitten something relevant stops working.

So, questions:

a) How to uniquely identify an Object3D?
or
b) How to dispose things in JPCT so that the next time the applet gets loaded the IDs and names are the same?

Thanks a lot

Tulsi

EgonOlsen

That's because the VM isn't reinited on reload, so the classes are not reloaded and the static members don't change. Adding this to your applet should help:




 public void destroy() {
     texMan.flush();
     Object3D.resetNextID();
     super.destroy();
 }

quixote_arg

I had


public void destroy() {
    theWorld.removeAllObjects();
    texMan.flush();
}


Close... but not close enough!

Thanks Egon!

EgonOlsen

Merge the two...:wink: because removeAllObjects() is also a good idea.