Hello.
I'm a Java developer by trade, but I've recently started looking at jME for fun in my spare time, and I've come across something that looks like a bug to me, although most likely I've got it all wrong somehow.
I reckon there may be a bug in Node.findPick:
@Override
public void findPick(Ray toTest, PickResults results, int requiredOnBits) {
if(children == null) {
return;
}
if (getWorldBound() != null && isCollidable(requiredOnBits)) {
if (getWorldBound().intersects(toTest)) {
// further checking needed.
for (int i = 0; i < getQuantity(); i++) {
( children.get(i)).findPick(toTest, results);
}
}
}
}
( children.get(i)).findPick(toTest, results, requiredOnBits);
Because, if I understand the point of the collision mask, you only want to get those children that have any of those bits set. But, by not including requiredOnBits in the method call, it gets defaulted to 1 (in Spatial), which may not be the collision mask (requiredOnBits) that you called Node.findPick with.
I think I've got a workaround for this, but if this is a bug, I'm suprised that no one's spotted it and fixed it by now, as I'm not really doing anything that complex. All that happens in my "game" is that you walk (instead of flying) on top of any objects below you (instead of flying through them), and surely every other jME game must have code to do that as well?
So, the reason I'm using collision masks is because sometimes the IntersectionRecord tells me that the "down" skybox mesh is right below the camera, when, in fact, it should be at -200. This only happens at the beginning of my "game" if I press "A" or "D" to move left or right (for reasons that elude me). So, the reason I decided to use collision masks was so that I could just ignore the skybox meshes when "finding picks" (things that collide with a Ray going straight down from the camera).
As I say, I'm new to jME, so I may well have just not done something the blindingly obvious way it was supposed to be done. But, one way or another, is that findPick method supposed to work like that?
Thanks!