![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | gruen |
Well i dont get it.
i can move my camera by clicking the mouswheel and draging the mouse
but also i can place tiles by clicking left mousebutton
now the tiles will appear annywhere but not there where the camera is.
this is what i wrote:
func _input(event):
if Input.is_action_just_pressed("mb_left"):
pressed_at_position = get_viewport().get_mouse_position()
if Input.is_action_pressed("mb_left"):
get_parent().get_parent().get_node("TileMaps/TileMap_Mauer").placeTile(pressed_at_position)
the problem is that icant use global mouse position. dont know why. but he sais there is none such function in base viewport
i dont have a idea how to put my tiles where i realy click at
Is this in 2D or 3D?
SIsilicon | 2019-09-24 01:50
It’s in 2d
gruen | 2019-09-24 04:18