Author Topic: Null when Object3D.CheckForCollision  (Read 4511 times)

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Null when Object3D.CheckForCollision
« 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.
Nada por ahora

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: Null when Object3D.CheckForCollision
« Reply #1 on: July 01, 2007, 12:03:23 pm »
Are you by any chance calling the checkCollision-method before adding the object to the world?

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Re: Null when Object3D.CheckForCollision
« Reply #2 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?

Nada por ahora

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: Null when Object3D.CheckForCollision
« Reply #3 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?

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Re: Null when Object3D.CheckForCollision
« Reply #4 on: July 01, 2007, 10:26:08 pm »
ok, I will post it later.
Nada por ahora

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Re: Null when Object3D.CheckForCollision
« Reply #5 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.
Nada por ahora