Force Camera Rotation

Hi,

I try to make a mini game where the player control something that can fly and roll when needed. For the Flying mode, I used the mechanic of the flying exemple in UE4. For the rolling mode, I used some of the rolling exemple. Now, when I press “spacebar”, movement affect the pawn differently, the physic is actived if necessary ect… all of there thing work fine. I just have 1 problem: the camera!

In flying mode, the camera follow the pawn, that more simple to control it properly. In rolling mode the pawn go forward (With torque) in the camera axis, all work fine and the camera don’t have to follow the pawn if it did, the camera rotate in all direction and it’s unplayable. To do that, I have set Inherit Pitch, Yaw and Roll to false for the SpringArm of the camera in rolling mode.

When I’m in flying mode, and if I flying around, the Z axis of the camera change, normal, for this exemple, to 90° from the initial Z axis. But when I change to rolling mode, the camera is like to re-initilaised and 0°… and when I go back to the flying mode, the camera is well placed, behind the pawn at 90° of the initial Z axis.

There is a way to force the camera, in this rolling mode, to be in the same axis that the flying mode when changing mode?

I have already tried “SetWorldRotation” with the rotation of the camera before changing mode, same with “SetActorRelativeRotation” and “AddActorLocalRotation” or “Set Absolute Rotation” to true for the SrpingArm, with no luck :confused:

Thank you for your help!

Ok, I found a solution by myself!

There is my solution, if needed by someone

Up is for Flying mode and bottom is for rolling mode