Author Topic: Object3D IDs and Names  (Read 3681 times)

Offline quixote_arg

  • byte
  • *
  • Posts: 9
    • View Profile
Object3D IDs and Names
« on: March 27, 2006, 08:05:55 pm »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Object3D IDs and Names
« Reply #1 on: March 27, 2006, 10:17:00 pm »
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:



Code: [Select]

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

Offline quixote_arg

  • byte
  • *
  • Posts: 9
    • View Profile
Object3D IDs and Names
« Reply #2 on: March 28, 2006, 03:37:16 am »
I had

Code: [Select]

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


Close... but not close enough!

Thanks Egon!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Object3D IDs and Names
« Reply #3 on: March 28, 2006, 08:17:22 am »
Merge the two...:wink: because removeAllObjects() is also a good idea.