Download

How to control rotation at possess? Unable to initialize/preset rotation of camera as game starts

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. Even stranger, it doesn’t seem to affect the location - which is the exact same value I set in the editor. I’d expect both to either work or both to not work.

The level blueprint:


Blueprint in level:
ingame_updated_rotation.JPG

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 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. Edit: I realize it’s already possessed as it was correct on point 2, so it’s probably a refresh/update on the rotation happening here, for some reason

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.

Eyo,

Depending on your setup this might be different but I think that normally the camera is based on the Controller rotation and not the Pawn itself.
You can try this:

my dude you just saved me a lot of time here. thank you! setting control rotation rather than camera works perfectly.

Nice,
Happy that it worked out in the end!