Author Topic: extended Object3D in world  (Read 2187 times)

Offline Sloothword

  • byte
  • *
  • Posts: 12
    • View Profile
extended Object3D in world
« on: July 19, 2006, 08:35:56 pm »
Hi

I  extended Object3D with:
Code: [Select]
public class GameObject3D extends Object3D {

my Constructor is the following:
Code: [Select]
public GameObject3D(Object3D arg0){
super(arg0);
}


Now the problem:

I add this Object to the world using
Code: [Select]
myWorld.addObject(myGameObject3D);
When calling myWorld.getObject(2) with an GameObject3D on position 2 I get the
Code: [Select]
Error: can't retrieve object #2

Thx for all Help
Sloothword

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
extended Object3D in world
« Reply #1 on: July 19, 2006, 09:17:36 pm »
This has nothing to do with your class extending Object3D. That's fine. The getObject()-method in World needs the ID of the object, not the position. You can obtain this ID either from the Object3D itself or you use the int-value returned by World.addObject().

Offline Sloothword

  • byte
  • *
  • Posts: 12
    • View Profile
extended Object3D in world
« Reply #2 on: July 19, 2006, 10:57:27 pm »
I use the Object3D.getID();
Sorry position is the wrong word.
Its ahrd to Debug because I edit the World in two threads which you should never do. So I first have to change my Structure and then I can test this problem again.
Thanks for your quick help.
jPCT is just great