How to control rotation at possess

I’m trying to control what rotation and location the camera starts at during play. My pawn contains a camera and SprinArm, just as the standard examples do AFAIK.

I’m setting the ActorLocation of the pawn during the level’s BeginPlay, but right after this script has executed I notice that Unreal resets the rotation as the pawn seems to be possessed. What is strange is that the rotation is based on what I have in the editor/level; so if I rotate 90 degree inside the editor/level, then that’s the rotation I will end up when pressing play. It doesn’t seem to affect the location.

Blueprint in level:

The Pawn’s location (correct) and rotation (incorrect) after I start playing:

The Pawn’s location is correct and rotation (yellow) is incorrect after I start playing. The sequence of events is like this:

  1. The level’s BeginPlay code starts
  2. I set Actor Rotation and Actor Location on pawn. Right now the camera is looking correct in-game.
  3. The level’s BeginPlay finishes
  4. (My assumption). Unreal runs some built-in functions to possess the pawn and my previously correct rotation (but not location) is overwritten. This happens about 10ms after the BeginPlay finishes.

In this example I’ve rotated the camera inside the editor before pressing play, and that’s the rotation I then end up with in-game. My questions are:

  1. Why is it using the editor’s rotation?
  2. How can I control/change the rotation? I need to place this camera almost pixel-perfect during begin play and can’t be messing around with yaw/pitch to get where I want.
  3. Could it be that I’m using the Pawn wrong, that it shouldn’t update the rotation of the camera but rather the offset on the arm? Note that this game is top-down so the “Pawn” is just an invisible thing with a camera following it.

Just as a comment on point (4). I assume it’s actually already possessed, otherwise it wouldn’t be “correct” to begin with (point 2). But there’s an update of rotation happening here, for some reason

hi Greasy, the first thing I’d check is that the engine spawns a random extra camera on level start… so first I’d just enure that you are actually using your Pawn’s camera at BeginPlay using SetViewTargetWithBlend… if so, it’s a quick 'n easy fix, if not just get back here and we’ll get it sorted :slight_smile:

I had to reset the Controller Rotation under Player Controller, which is what UE used to preset the orientation. It now works

Thanks for the reply! Someone tipped me off to check the the controller rotation under player controller. The controller rotation would inherit whatever rotation I had in the engine, so after resetting this it works.

This was driving me mad…
No matter what I did, upon possessing a pawn the player controller just did its own thing with the camera rotation. SetActorRotation had no effect, didn’t matter how the pawn’s camera component was initially oriented.

The ONLY THING that worked was to use SetControlRotation inside the player controller immediately after possessing the pawn.

Unreal certainly has a lot of dark software holes, this being one of them.