How to control the mouse with a 2D camera?

How to control the mouse with a 2D camera? I want that when you hold down the mouse wheel, you can move the camera, and so that when you turn the mouse wheel, the camera moves away and comes closer. But I didn’t find such a function

In Project Settings > Input Map you can create an action that gets triggered by mouse wheel scroll. You probably want two actions - zoom in and zoom out. You then check for them in code as you would with any other.

For detecting mouse movements, you have to catch event objects sent into _input or _unhandled_input functions. Check the type of the event and extract the necessary mouse movement from it. Docs:

2 Likes