Weird intersection problem

Hi everyone, i think this one is easy, i have a node witch i can control and i want to do something if it intersects a specific node. I'm having troubles when i call getWorldBound() in that other node.

Like:

 //the class extends Node
Node checkPoint = new Node();
      checkPoint.attachChild(box);
      checkPoint.setLocalScale(2);
      checkPoint.setModelBound(new BoundingBox());
      checkPoint.updateModelBound();
      this.attach...;

when i call... (not in this class)
System.out.println("CheckPoint:"+checkPoint.getWorldBound()); //test!


the world bound is null. If i attach a box for example, it is not null anymore but i get "java.lang.NullPointerException at com.jme.renderer.lwjgl.LWJGLRenderer.draw(Unknown Source)". I just want a invisible box to hit and then do something.
Any ideas?
Thanks.

What is box that you are attaching to the node? Maybe you could get rid of this problem by attaching an empty TriMesh or something like that.

It might be that you're using the empty box constructor, which doesn't initialize the geometry data, that would explain the NPE in Renderer.

Momoko is right… try to use the constructor that has some more data in it (at least a name must be provided)

duenez said:

Momoko is right... try to use the constructor that has some more data in it (at least a name must be provided)

I've tried this and i got the same NullPointerException. Everything loads correctly and the error happen when the camera is about to show that node. Also the error happens if i use a Quad.
:-o

Actually, it looks like you never update the world bounds.  Do you call either updateWorldBounds or updateGeometricState (which calls updateWB if you haven't locked them)

I had to use a model to represent it, problem solved, thank you all.

:slight_smile: