Event position relative to displaced cam

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Suleymanov

I pick objects using event position info. But when I navigate the camera around, event position is useless, I can’t locate the objects I want to pick through the displaced camera. How can I fix it?

PS: It’s a 2D top down scene.

Thank you for your time!

Please update your question with some code and maybe explain which event you use and how the camera is moving?

clemens.tolboom | 2021-07-14 15:44

:bust_in_silhouette: Reply From: AlexTheRegent

Since your game is 2D, and 2D nodes inherits from CanvasItem, you can use get_global_mouse_position and get_local_mouse_position methods to get global and local mouse positions, respectively. You probably need global mouse position to handle objects pickup actions.