swap between multiple cameras in through widget button

Hi,
I’m struggling to toggle from one camera to another.
I have my main camera on my character and I have 2 on a BP that I want to swap between depending on what widget button I click. I can successfully change from my players camera to the CameraUpgrade but never to CameraSkills. What am I doing wrong below?

BP

Widget on button click event

Hey @DarkEmbrace96!

I’m not seeing any issues here. Both of these seem identical with a different variable of the same object type and they’re both on your Blueprint. Everything here is fine, the problem would have to be somewhere not shown! Maybe in the button for switching to the CameraSkills camera? :slight_smile:

No problem with the buttons themselves. The print strings are working too and I’ve checked with breakpoints.

I have however just noticed that changing the camera hierarchy on the BP makes a difference. The problem is it doesn’t matter what button I click on in the widget, it will always change to the camera that is at the top of the hierarchy as in I moved CameraSkills to the top but now CameraUpgrades no longer works at all.

image

The set view target node will switch to the first active camera it can find. To switch between 2 camera components in the same BP, all that is needed is:


When you switch with Set Blend, ensure there is only one active camera in the New View Target:

image

The Set View Target with Blend will then have no choice.

2 Likes

Brilliant, cameras all swap as expected :). Just one more thing, is there a way to blend with the SetActive node.

I’m now using this method on button clicks but it now instantly swaps to the camera


Not with the blend node. Use a Timeline instead and Lerp between transforms. Rather than having 2 camera components, you move 1 between 2 coordinates.

It will give a lot of control, too. To the point where you’re likely to ditch Set View Target Blend altogether. That node is a bit fire & forget, mostly the latter.


Alternatively, if you don’t need control and prefer a simple solution instead, turn the camera into an actor and wrap it with a Child Actor Component.

This way you could target a very specific camera with the Set View Target node.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.