# Zoom camera in c++

**URL:** <https://forums.unrealengine.com/t/zoom-camera-in-c/475454>\
**Category:** Cinematics & Media\
**Tags:** zoom, unreal-engine, Visual-Studio, question\
**Created:** [December 5, 2020, 7:21pm UTC](https://forums.unrealengine.com/t/zoom-camera-in-c/475454 "2020-12-05T19:21:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peppoz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Peppoz](https://forums.unrealengine.com/u/Peppoz)\
**Post date:** [December 5, 2020, 7:21pm UTC](https://forums.unrealengine.com/t/zoom-camera-in-c/475454/1 "2020-12-05T19:21:17Z")

</div>

Hi, I’m having problems with changing the field of view of my camera at certain moment. I am a newbie both with the engine and c++, so I might have made a mess.

I tried this in the first game template and since I have no idea yet how to bind keys I tried to add the zoom to the built-in onFire function from the Character class. I was thinking about setting the field of view to a float that I have declared EditAnywhere so that I could edit outside visual studio. The problem is nothing changes when I try the game.

Here’s the method:

 ![324008-onfirefunction.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/a/2/5a23f45e097b2f4ce172ce16ee39a94e4567b826.png)

The underlined one is the only line I added.

---

<div class="post-metadata">

**Author:** ![Peppoz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Peppoz](https://forums.unrealengine.com/u/Peppoz)\
**Post date:** [December 6, 2020, 7:59pm UTC](https://forums.unrealengine.com/t/zoom-camera-in-c/475454/2 "2020-12-06T19:59:43Z")

</div>

For anyone interested, I was able to solve it.  
I simply created another 2 key bindings, called them “Zoom” both on pressed and released and assigned them to right mouse key.

![324092-solve.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/4/f/04f7ca1a7af82f5bb912e22a99d79169689af5cf.png)

Then I added these 3 methods, the first one returns me the default field of view, the second and third are the actual events, where I set the field of view to a new float, and returns back when I release the key.
