GUI not returning right gui box node

I’m having a hard time getting my gui to return the gui box I’m clicking on. I’ve tried so many different things it’s driving me nuts.

I now debug print everything and where I’m clicking should NOT be returning the node it’s returning.

The top boxes work perfectly and return correctly. The circled box to the right isn’t accurate. I click well to the left of it but it returns saying I’m clicking on it.

DEBUG:SCRIPT: Checking bet zone bet_zone_any_seven at Position: (1298.00, 585.00)
DEBUG:SCRIPT: Placed bet on bet_any_seven: 0

I’m clicking at (1142, 569)

DEBUG:SCRIPT: Touch position (adjusted):	vmath.vector3(1142, 569, 0)
DEBUG:SCRIPT: action.screen_x: 	1142	action.screen_y: 	569
DEBUG:SCRIPT: action.x: 	1142.5	action.y: 	569.5
DEBUG:SCRIPT: Root position (local):	vmath.vector3(1142, 569, 0)

But some reason it’s saying I’m clicking on a GUI Box that is clearly to the right of that.

DEBUG:SCRIPT: Checking bet zone bet_zone_any_seven at Position: (1298.00, 585.00)
DEBUG:SCRIPT: Placed bet on bet_any_seven: 0

Also for other Box Gui Nodes the Y axis is off. I have no idea how to fix this. This is a 3D scene (top down camera).

You are probably not rendering the GUI using the standard screen space projection. This will cause mouse coordinates to not align with the actual position of the box nodes. You need to either go back and render the gui like in the default render script or translate the mouse coordinates into the space your gui is in.

1 Like

Yes that must be it. I had to change the render script to ensure the dice render on top of the gui.

But one thing odd is that the pi (circle) shapes work everywhere on the GUI. It’s just the boxes that have the issue. I’ll have to play with the render script to figure this out.

Thank you.

1 Like

I figured it out. I was anchoring top left. So my calculation to determine if the click was inside the box node was off. Anchoring in bottom left fixes it.

1 Like

BTW: While this issue wasn’t a render issue my next one was. So your tip helped me narrow it down really quickly.

For those browsing the forum in the future. If your text has a black background and you can’t make it go alpha. It’s a render.script issue.