How to make Camera2D that follows mouse cursor while keeping player inside (like nuclear throne)

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

Hello, Godot community. Im very new to Godot and game programming. I am attempting to make 2D topdown shooter game like nuclear throne with godot. However, I have no idea how to implement a camera system that follows mouse cursor while keeping the player inside the camera, like the one from nuclear throne. I would appreciate if you could teach me how to implement this feature.

Did you get it working?

Bump | 2023-06-03 14:52

:bust_in_silhouette: Reply From: CardboardComputers

You can lerp the position of the camera between the player character’s position and the mouse cursor’s position (in world space).