Moving FPS Camera to Look At Object

Hey Everyone

I’ll try to explain this the best I can.

I have an actor (in this case it’s a campfire). The player can interact with the campfire when looking at it (done via line trace).
Now what I want to do is, when the player interacts with the campfire, I want the camera to move just so that the campfire appears in the center of the screen.

Since i’m using a line trace for the interaction, the campfire is always in view of the camera, but is not always in center of the screen. I’m not sure how to approach this.

Any help would be much appreciated.

You could add a long collision volume attached to the front of the player to do the interaction / detection part and then tweak the player camera to be centered on the fire. If the player moves away the overlap will be broken. Then you can cancel the centered camera altogether. Of course, if this is one-off gameplay, you could just add a collision box with begin / end overlap events at the fire itself…

To change the camera you could add a permanent second camera behind the player that doesn’t rotate with the POV of the pawn and then just Activate that… Or you could use Set View Target With Blend on an independent camera. The latter, has the advantage of blending into the new POV, which looks smoother / less abrupt… But it will also slow the interaction down somewhat.

The way I have my interaction setup at the moment, I don’t want to change as it needs to work this way for how I have everything setup.

All I want to do, is if the player looks at the campfire and then presses the interaction button (in my case ‘E’) I just want the camera to turn whichever way it needs to so the campfire appears in the middle of the screen. I just don’t know how to make the player/camera move to look at the let’s say the center of the campfire.

I have added a couple of screenshots below. The first screenshot is how I want it to be. The second is how it can currently look. Since i’m using a line trace, as long as i’m hitting any part of the campfire and not just the middle, the fire can appear off center.
I just want to know once i interact with the fire, is it possible to move/pan the player/camera view so it goes from like screenshot 2 to screenshot 1.

You can use the same approach as detailed here

Thanks, i’ll give it a shot.