Rotate Camera C++

“ViewTarget” is actor that is currently display. The way it is work is, on every frame PlayerCameraManager ask ViewTarget (a actor) by calling it’s function CalcCamera() to get camera position, so it kind of like asking how actor which to be displayed:

The default code inside AActor class CalcCamera searches for active camera components inside the actor and it gives out world position of first active camera component inside Actor, so by default location of camera component inside the actor controls camera view. You have 2 options:

-Either change position and rotation of camera component (or place camera component if it’s missing) inside ViewTarget actor

-Or override CalcCamera function of Actor you use as ViewTarget to manually output camera positioning

Note that by default Possessed actor by PlayerController automaticly becomes ViewTarget, you can disable this behavior by setting bAutoManageActiveCameraTarget to false in PlayerController

1 Like