Camera switch between first person and top down but movement is not correct.

Hi im doing a project where the Player is able to switch between firts person and top down perstecive. When you load in to the project the player start in top down and can move with wasd. w for up s for down a for left and d for right. When im switching to first person the movement is corresbonding to the direction im loocking. That is all as it is supossed to be. But now the problem if you turn for example 90 degress in first person and then switch back to top down the movement changes so that w is now the way you loocked last in first person but i want it so its still the same as before. I tried to set the rotation of the actor the way i want it but that dind´t change anything. What could help?



Hello @B3NITH3HUNT3R

It turns out that your character in first-person mode should move relative to where he is looking, and in third-person mode he should move strictly along the world axes (for example, moving forward is always on Y+), right?

Exactly, that is want i want to achive

@B3NITH3HUNT3R
Here is an example of the logic of how such mechanics can be implemented:

Pressing the “C” key changes the IsFirstFace variable.

We then set the camera’s UsePawnControlRotation to: true if the view is in first person; false if this is not the case. If we do not disable this variable, we will not be able to rotate the camera separately from the character, which will be necessary when changing the view.

With Branch and IsFirstFace we disable the player’s camera rotation when switching to top view. In fact, rotation can not be turned off, but changed so that, if necessary, it is convenient to rotate the camera when viewed from above.

And finally, using Select and IsFirstFace we change the movement vectors forward and to the right, if the variable is true, then we use the forward vector and the right vector of the character, and if false, then for the forward vector we use the vector world axis X+, and for the right vector world axis Y+

1 Like

Thx thats exactly what i needed.