object don't go to the cursor

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

has u can see the block don’t go to the same position of the cursor
but if the camera is in a certain position i can place block correctly

how to fix that

:bust_in_silhouette: Reply From: EnrikeChurin

The link you sent has expired. And the description is not clear, so I can’t guarantee fitting answer.

From what I can understand, you need to have blocks placed in the position of the mouse cursor, but if you move the camera to a different place, it’s doesn’t adjust to it.

I’m assuming that you use this code for getting mouse position:

get_global_mouse_pos()

It gives you global mouse position. And when the camera isn’t lining up, it will be incorrect.

To get mouse cursor position relative to camera, use this:

get_viewport().get_mouse_position()