Hello,
I have this Canvas3D (using Java3D) with my 3D scene in it, with a PickMouseBehavior, and then a JPanel on the side for debugging. Thing is, i also have some 2D images on top of my canvas3D (using postRender(), think of it as an overlay menu) which also has to be able to read the mouse input, but only if the mouse is over a 2D image, so that it won’t go through the 3D picking instead.
How do you do this?
I figured i could somehow hack the picking behavior, but i’m not sure it’s the best way. Any help or suggestion appreciated!
Thanks!
edit: I’m thinking of creating a class called Button2D containing the position and rectangle of each buttons in my overlay, add them in an ArrayList, pass it to the mouse picking and test it against the cursor’s position before the actual 3D picking. If the cursor is withing bounds, return the Button2D’s ID.
I guess it could work?
edit2: Well, it’s working fine I guess i just needed to think “aloud”, heh. Anyway, if there’s better solutions, i’d still like to hear them.