Position and absolute position


I found that the position parameters of my NodePath (reparent to window->get_aspect_2d()) is different from the parameters of the cursor at the same place in the window. For example, when the cursor in the position that I use get_pointer(0).get_x() can obtain a value 512, and my NodePath use the get_pos may just results in -1.2.
I think it’s a difference caused by position and absolute position, is the former just refer to the parent node? Hopefully, is there some APIs that can help me to set the absolute position of my NodePath in the window instead of set_pos (which is not unified with the cursor pos).


The render2d coordinate system ranges from -1 to 1 in both the X and Z axes. The aspect2d coordinate is similar to this except that it is scaled by the window’s aspect ratio.

If you want something to match a cursor position, you need to either scale the cursor position so that it falls within these coordinates, or you could scale the render2d node such that it matches the pixel size of the window.


Thank you for your response, I get it now!