Download

Set control rotation without changing direction

I’ve been learning Unreal for a couple of weeks and I’m working on a first person game where I hop out of a vehicle then I turn around, walk towards the vehicle and re-enter it. I want the vehicle’s camera to be pointing in the direction of the vehicle, so I set the vehicle’s camera world rotation to that of the vehicle before possessing it.

This works, but now my player controller is messed up. If I hit ‘w’ to move forward the vehicle it moves in the global X direction even though the vehicle is rotated a different direction. Pitching is also relative to the unrotated initial view.

I printed out the control rotation while inside the vehicle. The R,P,Y numbers change as expected when I turn the vehicle. When I exit the vehicle, the RPY of the control rotation changes to 0,0,0 rather than the latest RPY values from before I exited.

When I re-enter the vehicle, even though the vehicle is still oriented in the direction I left it the control rotation is still 0,0,0. So now the control rotation does not match the vehicle orientation.

How do I reset the control rotation to what it should be without rotating the vehicle?