Hi!
I have a little problem with choosing an object. I use the code:
MouseInput thisMouse=MouseInput.get();
if (thisMouse.isButtonDown(0)){
Vector2f screenPos=new Vector2f();
screenPos.set(thisMouse.getXAbsolute(),thisMouse.getYAbsolute());
Vector3f worldCoords=display.getWorldCoordinates(screenPos,0);
Ray mouseRay=new Ray(cam.getLocation(),worldCoords.subtractLocal(cam.getLocation()));
PickResults pr = new BoundingPickResults();
pr.setCheckDistance(true);
scene.findPick( mouseRay, pr );
for(int i = 0;i < ile; i++) {
if( b2[i].getWorldBound().intersects( mouseRay ) ) { b2[i].setRandomColors();}
}
}
It change the color of Box that I click, but when I have some other object behind object that I have click is change color too. How I can fix it ?? I want only first object change color.
TIA everyone.