Switching to a rear facing camera without affecting player's axes movement

Hi, I have scripted a camera so that when the player is running by holding down the ‘w’ key he can also hold down the shift key so the camera looks directly behind him. However, this then affects the direction he is running in.
What can i do to avoid this?
I am reading that it is to do with the object and world space but I am not sure how to implement it?
Together with an offset, I am currently switching the camera view to look behind the player using:

CAMERA.CFrame = Char.Head.CFrame * CFrame.Angles(0,math.rad(180),0)

You can try changing the CameraType to scriptable. This way, you can make the camera look backwards behind the character. But you also have to script the velocity of the camera moving in the direction of the character while its simultaneously looking backwards.

In my experience the player will always move in a direction relative to the camera’s rotation, even if it’s set to “Scriptable”.

I’m not entirely sure what you mean by direction relative to a camera’s rotation, but I believe you’re trying to say that the camera still follows the player even when being changed to scriptable. However, changing the CameraType to scriptable causes the camera to stop being influenced by the internal camera scripts. The camera does not move nor rotate.

What I’m saying is that the Humanoid’s MoveDirection is relative to the camera’s Y rotation.

I don’t think it is:

If you hold W, you will move in the direction that the camera is facing.

The must be some way of making them mutually exclusive. In a sidescroller a camera stays facing the player’s side when using the ‘A’ and ‘D’ keys.

Oh, interesting observation. I was never aware of this.

So are you guys in agreement that it cant be done simply? The only solution i can think of is to change the player’s directional velocity in relation to the camera angle but tbh for what it is worth, it is too much effort for such a minor feature.

I’m not sure how this would be done other than using a custom camera script.

One solution you can try is to make a rear camera using a viewport frame. I’m not entirely sure how this will work performance-wise but I guess its worth a shot.

Thanks Venom, the viewport route was how I originally started out but it was too resource intensive and so I hoped that i could solve it with a simple camera switch.

Are you looking to make the movement not relative to the camera? Then I believe you can overwrite the default control script through this custom control script:

Thank you for the idea dthecoolest though i couldn’t use it as it was mouse based. However,I have now sorted it myself by simply multiplying all my UserInputService variables by -1 whilst the rear camera button is pressed. Thanks to all for offering advice