How do create a camera to unlocks from the player when I want to pan it with WASD controls

What a coincidence :smile: Your objective is the combination of some of my recent approaches for other people! Hold on for a moment.

Alright! So is this your objective?

  • The map can be freely navigated with the camera
  • While not locked on, the player character’s location doesn’t affect the view
  • The camera smoothly locks on the player charater on input
  • When locked, only player character’s location determines the view

Here’s the setup, along with some extra stuff like zooming and clamping :wink:

Create a character class blueprint for the player character, but do not add any camera or spring arm components to it.

Then create a pawn class blueprint for the camera and add a camera component to it. You can also set it a tilt directly from the viewport.

Here’s the Event Graph of the player character’s blueprint:

Above :point_up: are the related parts to the control of the player character. Below are also inside the same Event Graph, but parts related to the control of the camera:

The timeline:

And the Event Graph of the camera pawn:

And finally, the collapsed graph for clamping:

Hope this helps! :innocent:

1 Like