Godot Version
4.2.1
Question
Hi, in drawing software you can zoom the camera to the mouse. This means that if you have your mouse on a certain pixel, after zooming, the mouse will still be on that pixel. How do I implement this in Godot? I tried using the solution in Camera2D zoom position towards the mouse but it didn’t work. It seems to zoom into the bottom right corner (which is 0,0).
func set_zoom(delta: Vector2) -> void:
$Camera2D.zoom += delta
$Camera2D.global_position += (-0.5 * SCREEN_SIZE + get_global_mouse_position()) * -delta