www.jpct.net

jPCT - a 3d engine for Java => Bugs => Topic started by: Melssj5 on July 01, 2007, 07:26:22 am

Title: Null when Object3D.CheckForCollision
Post by: Melssj5 on July 01, 2007, 07:26:22 am
Hi, I am getting a NullPointerException when calling to any of the checkForCollision methods on an Object3D.

the exception is:

java.lang.NullPointerException
        at com.threed.jpct.Object3D.checkForCollision(Unknown Source)
        at Auto.RenderThread.hacerMovimientos(RenderThread.java:262)
        at Auto.RenderThread.run(RenderThread.java:221)


both objects has the collision modes:

carro.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS | Object3D.COLLISION_CHECK_SELF);
mapa.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS | Object3D.COLLISION_CHECK_SELF);

I am using the beta version with the env forced to the second stage.
Title: Re: Null when Object3D.CheckForCollision
Post by: EgonOlsen on July 01, 2007, 12:03:23 pm
Are you by any chance calling the checkCollision-method before adding the object to the world?
Title: Re: Null when Object3D.CheckForCollision
Post by: Melssj5 on July 01, 2007, 05:04:01 pm
No.  >:(

1.- load the models

2.- the object3D carro has as childs all the main parts loaded

3.- set the collision modes of carro!

4.- buildAllObjects

5.- render

6.- check the collision


Should I set the collision modes for all the parts of the car and not only to the parent of all of them?

Title: Re: Null when Object3D.CheckForCollision
Post by: EgonOlsen on July 01, 2007, 06:31:14 pm
I can't verify this problem. Whatever i do, it works fine. Can you create a minimal test case that shows this problem?
Title: Re: Null when Object3D.CheckForCollision
Post by: Melssj5 on July 01, 2007, 10:26:08 pm
ok, I will post it later.
Title: Re: Null when Object3D.CheckForCollision
Post by: Melssj5 on July 05, 2007, 04:34:08 am
FOrget it, solved, I was adding the childs to the world but not the parent. This was the problem.