is there a way i can switch between 2 cameras by which weapon my character is holding?

I know how to do this on a button press or a trigger box, but i want the camera to switch when i change weapon from rifle to pistol for example? like how i blend pose by weapon type enum but instead for the camera?

I am using something similar to switch between first and third person. Basically I handle the cameras in blueprint and use the SetActive node to deactivate one and activate the other whenever I’m switching.

The switch is not smoothly blended though, as I don’t have need for this.

EDIT: So I just have two pre-positioned cameras on my character, and one is deactivated in a function called from the BeginPlay (depends on a boolean, but you could also choose by enum). And it gets switched with the same function.

Let me know if you need more help!

Basically I handle the cameras in
blueprint and use the SetActive node
to deactivate one and activate the
other whenever I’m switching.

Are you doing this in order to force Set View Target with Blend to use the only active cam?

Hey thanks for the reply,

I will take a look at this, would you mind posting a screenshot of what the function looks like?

I actually didn’t know this node before ;'D

But as I don’t want blending but instant camera switching instead…

Here is a screenshot of how I switch cameras. It’s in a function in my character BP.

If you want smooth transitions instead, you could use Set View Target with Blend like Everynone suggested. [Here’s a video][2] demonstrating it. It’s turkish but I guess you shouldn’t need the talking for this one :'D

If you need further help, just ask.

you could use Set View Target with
Blend like Everynone suggested

I wouldn’t suggest it actually, the node is kind of dumb. The desired behaviour couldn’t be previously achieved with the Set View node. When you mentioned activate / deactivate components I just though it was perhaps fixed in 4.23 (and who knows, it might).

If an actor has multiple cameras, the Set View will find the first one, rather than the one you want or the active one… often rendering it pretty useless. That’s how it used to work at least.


Another solution to camera switching is to store transforms (or location + rotation). And move the camera to that location using a timeline or just snapping to loc+rot. So you’re just using a single component. And the loc + rot can be interpolated, too if needed.

On the other hand, activating / deactivating components for an instant camera switch is something I’ve never tried. Glad to find it works well for this. Thanks for sharing!

Oh alright!

Yes, I am basically forcing my will upon default camera selection by deactivating all others ;'D

I didn’t manage to find another way in a reasonable amount of time so I just stuck with this.

And I wanted to preplace the cameras in the editor (don’t ask me why, I guess it makes it a bit easier for me to work with) so I didn’t want to use locations. But it’s totally valid of course.