Why does Possess move Camera to Pawn?

I’m really new to UE4 so bear with me. Coming from an Unity background, I’m quite lost.

I want to have a Top Down Camera and 2 players that can be controlled locally using the keyboard.

I created a new PlayerController and binded the keys to move the players around. In the BeginPlay method, I instantiate 2 players (simple Pawns with a static mesh) and hold their references to add motion later.

When the input is received, I possess the pawn to add motion to it. The problem is that when I possess the pawn, the camera position is moved to it. Why is that so?! I can’t get it… For example on a RTS, you have a camera, and select different actors to give them actions. The camera stays exactly in the same position. My pawns don’t even have a camera componen attached to them! I must be missing something. Also, if I don’t possess the pawn, they simply won’t move when input is received. I guess they MUST be possessed.

I want to leave the camera stationary aiming downwards and be able to move both pawns without it affecting the camera position. How do I do it?!

In this kind of cases it’s good to check engine source to see what what causing it or even search something in API reference of PlayerController (as he possess and he probably one setting camera too) and you can find this:

https://github.com/EpicGames/UnrealEngine/blob/7fdf681ee21b111524848ade9e952de3ad3fa1ac/Engine/Source/Runtime/Engine/Private/PlayerController.cpp#L3241

As you can see it default behavior of SetPawn and not only that you can disable it with setting bAutoManageActiveCameraTarget to false which you probably could find in API refrence

Yea i know i did that hard way :stuck_out_tongue: but atleast i showed you how you can solve this kind of problems yourself

Thanks for the answer , specially for pointing me to the API reference but it did not solve my problem, unfortunately. I thought it would though, because the variable description matches my problem.

I set the bAutoManageActiveCameraTarget to false in the PlayerController constructor but the same things happen.

I hit play and the Default Pawn is spawned at the PlayerStart position like it should, floating around and turning as expected. When the PlayerController possess the pawn to add input the camera does the same thing, it moves to above the pawn transform position.

I realized that there’s a PlayerCameraManager in the PlayerController, perhaps its associated to it? Why don’t the camera just stay put at the Default Pawn…

Well then check if somethings sets it to true, if it’s really “true” on play, or you might find other trigger in UE4 source. Make sure that your PlayerController class is used. If not then you might try to play with PlayerControllerManager, which controls the camer and you can also override it (you can set your cameramanger class in package settings) to have full control over camera, you actully might find it as a better solution if you making RTS game.

I double checked that the bAutoManageActiveCameraTarget is not true during play. Thanks for your attempt so solve my question anyway. You might have answered it correctly and I’m doing something else wrong somewhere else. Unreal programming is really hard!

Well then experiment :slight_smile: You can always take full control over PlayerCameraMenager

I think this is what is happening.
“bTakeCameraControlWhenPossessed, where the Pawn will automatically become the ViewTarget upon possession by the PlayerController”

You can try setting this boolean to false.

I tried that one too when I had this problem. It also did not work. I found not a solution, but a workaround on another question: https://answers.unrealengine.com/questions/24952/wisdom-request-disembodied-static-scene-camera-in.html