www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: Sloothword on July 19, 2006, 08:35:56 pm

Title: extended Object3D in world
Post by: Sloothword 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
Title: extended Object3D in world
Post by: EgonOlsen 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().
Title: extended Object3D in world
Post by: Sloothword 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