Can't set rotation of USpringArmComponent

Hi All

I’m quite a noob coder so apologies if the answer to this is obvious;

I’ve got a place in a level where the player transfers from one character to another. The idea is that the first person pov of the old character becomes the third person pov of the newly possessed character. By giving the new character’s cameraboom the length of the distance between the old player camera and the root component, the player is at the right distance from the new character after taking possession. However, I’ve tried to use both SetWorldRotation and SetRelativeRotation on the cameraboom, and nothing happens. I can’t get it to be at the right angle to the new character on possession- it starts off directly behind the character or close to it.

Anyone know why this is happening and what I can do about it?

Thanks!!!

Hi Robbie,

Is bUseControllerViewRotation set on the spring arm component? If so, it’ll change rotation every tick to match the Controller of the pawn if it is owned by a pawn.

Cheers,
Michael Noland

Hi Michael

I was setting it to false and then back to true again. Which is bad logic, I think. I put some debug lines in the springarm cpp and it’s ticking as the character stands in the world, and shows the pawn rotation as 0,0,0. I’m going to work on it some more today but it looks like I need to update the bool after the possessing pawn has registered, or make a derived version of springarm that doesn’t tick till after it’s been possessed. Many thanks!

That’s interesting. I switched bUseControllerViewRotation off and left it switched off. Now the camera is in exactly the right place after possession. Obviously it’s stuck there at the moment. But even after possession the pawn rotation is showing as 0,0,0. I’m wondering how to go from here, to having the controller smoothly move around the character from this position…