Node with multiple Quads - collision check

Hi everyone,

maybe this is a stupid question but I am stuck with a problem regarding Nodes, quads and collision check!

I am building multiple Quads and adding them to a Node. Then I am checking this node for collision!

speederNode = new Node("speeder");
      for(int i = 0; i<50; i++){
      speeder1 = new Quad("speeder"+i, 8, 8);   
      float x = (float) Math.random() * 350;
        float z = (float) Math.random() * 350;
        speeder1.setLocalTranslation(new Vector3f(x,1.1f,z));
      speeder1.setLocalRotation(new Matrix3f(0,0,0,0,0,1.0f,0,0,1.0f));
      // We need to make sure the quad is rendered after the land. QUEUE
      speederNode.setModelBound(new BoundingBox());
       TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
          Texture tex = TextureManager.loadTexture(
       return speederNode;

Now I check the Node with  checkSpeeder(speederNode, tpf);

private void checkSpeeder(Node n, float time){
             System.out.println("Collision detected");

It detects collision everywhere in the area. Not only when the player intersects with the quads!

Before this version I had several Nodes and attached one quad to each Node. Then I checked each Node for collision! It worked, but the code was way to long*g*

Thanks for any help ;)

You need to change your function to loop through the node's children like this:-

private void checkSpeeder(Spatial n, float time) {

if (player.getWorldBound().intersects(n.getWorldBound())) {

if (n instanceof Node) {

// Loop thorugh the nodes children

Node parent = (Node) n;

for (int i = 0; i < parent.getQuantity(); i++) {

checkSpeeder(parent.getChild(i), time);


} else {

System.out.println("Collision detected");





I've not actually run checked this, but it should work.  Basically, nodes cover the whole area of all the shapes they contain, so if the node is collided with, you then need to loop through the quads individually and check for collisions with those.