Hello
I need your help to understand what might be wrong. Overall it works, but noticed recently that my grid layout have some odd issues where raycast pick dont see Quad geometries even when his Quads are visible on screen. Below is code i use and video:
quad = new Quad(1, 1);
quadGeo = new Geometry("BoxQuad", quad); // using Quad object
all i do is:
CollisionResults results = new CollisionResults();
getGuiNode().collideWith(ray, results);
if (results.size() > 0) {
int i = 0;
System.out.println("--------------------------");
for (CollisionResult result : results) {
System.out.println("result"+i+": " + result);
System.out.println("result"+i+" parent: " + result.getGeometry().getParent());
i++;
}
//rest of code
}
where using:
new Ray(new Vector3f(app.getInputManager().getCursorPosition().getX(), app.getInputManager().getCursorPosition().getY(), 100000), (new Vector3f(0, 0, -1)).normalizeLocal())
but some of Quad even when visible on screen are not caught by this raycast.
if there is just result0, then it catch only global background alpha window.
if there are result0 and result1 it catch both grid Quad and global background alpha window.
video below:
- please look at results and raycast params. (z index might be wrong sometimes because i tested, but anyway it just dont see this BoxQuad for some of areas, and i really dont know the reason)
belive it might be something related to positioning(because only this grid layout seems to have issues), but since Quad is visible directly on screen it should be raycasted right?
also not sure why it is always for first, some middle and 2 last boxes.
I understand its probably some mistake i made, but hope you will help me find it
just one more note:
quad is updated this way:
quad.updateGeometry(boxTransform.getWidth(), boxTransform.getHeight());
and it is always in 0,0 in its parent node that only this parent change position.
btw. i dont use pictures because Quads are more universal.