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

**URL:** <https://forums.unrealengine.com/t/is-there-a-way-i-can-switch-between-2-cameras-by-which-weapon-my-character-is-holding/458879>\
**Category:** Cinematics & Media\
**Tags:** enumeration, unreal-engine, Blueprint, question\
**Created:** [November 27, 2019, 9:42am UTC](https://forums.unrealengine.com/t/is-there-a-way-i-can-switch-between-2-cameras-by-which-weapon-my-character-is-holding/458879 "2019-11-27T09:42:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![DAYSRKONDR](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DAYSRKONDR](https://forums.unrealengine.com/u/DAYSRKONDR)\
**Post date:** [November 27, 2019, 9:42am UTC](https://forums.unrealengine.com/t/is-there-a-way-i-can-switch-between-2-cameras-by-which-weapon-my-character-is-holding/458879/1 "2019-11-27T09:42:49Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![LordStuff](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LordStuff](https://forums.unrealengine.com/u/LordStuff)\
**Post date:** [November 27, 2019, 11:51am UTC](https://forums.unrealengine.com/t/is-there-a-way-i-can-switch-between-2-cameras-by-which-weapon-my-character-is-holding/458879/2 "2019-11-27T11:51:27Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [November 27, 2019, 4:53pm UTC](https://forums.unrealengine.com/t/is-there-a-way-i-can-switch-between-2-cameras-by-which-weapon-my-character-is-holding/458879/3 "2019-11-27T16:53:10Z")

</div>

> 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?

---

<div class="post-metadata">

**Author:** ![DAYSRKONDR](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DAYSRKONDR](https://forums.unrealengine.com/u/DAYSRKONDR)\
**Post date:** [November 27, 2019, 6:36pm UTC](https://forums.unrealengine.com/t/is-there-a-way-i-can-switch-between-2-cameras-by-which-weapon-my-character-is-holding/458879/4 "2019-11-27T18:36:49Z")

</div>

Hey thanks for the reply,

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

---

<div class="post-metadata">

**Author:** ![LordStuff](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LordStuff](https://forums.unrealengine.com/u/LordStuff)\
**Post date:** [November 27, 2019, 10:30pm UTC](https://forums.unrealengine.com/t/is-there-a-way-i-can-switch-between-2-cameras-by-which-weapon-my-character-is-holding/458879/5 "2019-11-27T22:30:53Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![LordStuff](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LordStuff](https://forums.unrealengine.com/u/LordStuff)\
**Post date:** [November 27, 2019, 10:35pm UTC](https://forums.unrealengine.com/t/is-there-a-way-i-can-switch-between-2-cameras-by-which-weapon-my-character-is-holding/458879/6 "2019-11-27T22:35:18Z")

</div>

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

 ![293115-camera.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/9/2/392a6face8626fc424f892596bc8fe541ddbf7ed.png)

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.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [November 27, 2019, 10:50pm UTC](https://forums.unrealengine.com/t/is-there-a-way-i-can-switch-between-2-cameras-by-which-weapon-my-character-is-holding/458879/7 "2019-11-27T22:50:29Z")

</div>

> 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!

---

<div class="post-metadata">

**Author:** ![LordStuff](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LordStuff](https://forums.unrealengine.com/u/LordStuff)\
**Post date:** [November 27, 2019, 10:59pm UTC](https://forums.unrealengine.com/t/is-there-a-way-i-can-switch-between-2-cameras-by-which-weapon-my-character-is-holding/458879/8 "2019-11-27T22:59:15Z")

</div>

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.
