Ray, .lock() and the not working PickResults

At first some Code:

public ManagerObjectLocked(TerrainBlock tb_new) {
  this.lock();
  tb = tb_new;
   
  //test
  listGegner = new LinkedList<GameObject>();
  testObj.setLocalTranslation(new Vector3f(200,1000,200));
  this.attachChild(testObj);
  listGegner.add(testObj);
  testObj.updateModelBound();
  testObj.updateWorldBound();
       
  testObj2.setLocalTranslation(new Vector3f(200,1000,190));
  this.attachChild(testObj2);
  listGegner.add(testObj2);
  testObj2.updateModelBound();
  testObj2.updateWorldBound();
}


In GameObject class:

public void activate() {
  if(isHit) {
    System.out.print("hit");
   
    if(vHP > 0) {
      vHP -= 10;
      System.out.print(": arrgh");
    }
    else {
      this.getLocalTranslation().z += 5f;
      vHP = 50;
    }
    System.out.println();
    isHit = false;
  }
      
  //Move from end to end
  if(move) {
    this.getLocalTranslation().x += 0.05f;
    if(this.getLocalTranslation().x > 249)
      move = false;
  }
  else {
    //this.getLocalTranslation().x -= 0.05f;
    if(this.getLocalTranslation().x < 1)
      move = true;
  }
}


And the "shot" in main update(tpf):

//Mouse input
shotTime += interpolation;
if(MouseInput.get().isButtonDown(0) && shotTime > 0.2f) {
  System.out.println("*peng");
  shotTime = 0f;
           
  //Testshot
  Ray ray = new Ray(cam.getLocation(), cam.getDirection()); // camera direction is already normalized
  PickResults results = new BoundingPickResults();
  results.setCheckDistance(true);
  scene.findPick(ray, results);
           
  if(results.getNumber() > 0) {               
    //Only hit first item (last in results)
    Node tmpNode = results.getPickData(results.getNumber()-1).getTargetMesh().getParentGeom().getParent();
    if(tmpNode.getName().startsWith("Obj")) {
      GameObject tmpObj = (GameObject)tmpNode;
      tmpObj.isHit = true;
    }
  }
results.clear();
}



So as you can see I lock the Manager (it extends Node). And it is the parent of the two testObj's. Without lock() I can hit them and they move like I want it. But when I start the code above...
1) ...I get no PickResults. And have no idea about the reason. As you can see I tried to update the bounds.
2) ...the GameObject's are still moving. Or I am wrong that they should not move?

Hint to myself:
If they stop moving I will find them in the air.

You need to add a bounding volume.

Try

.setModelBound(new BoundingBox());



on the nodes you try to hit

I do this in the code I did not post. It is done when I create a GameObject. This is the reason I can pick without "this.lock();".So it has something to do with this line.

Last test: I tried to hit them at their start position, because I thought I only see them moving while they do not move (or their BoundingBox's). But still get no PickResult.

Is the camera configured correctly?

If you use this line

  Ray ray = new Ray(cam.getLocation(), cam.getDirection()); // camera direction is already normalized

and if your objects are at 0,0,0 try to do a lookAT with the camera and see if you get a hit.

If I do it in every update:

The camera is looking at the GameObject. When it moves the camera is moving too.



I used "Debugger.drawBounds" and I can see that the BoundingBox is moving with the GameObject too.

I lock every GameObject now instead of the parent Node. This way I get PickResult and I dont have a huge BoundingBox around all GameObjects. And the locked objects don't move now too.