Player movement that is both reliant and independent of camera's vector

This may be complicated to explain but I’ll try my best to get it across and hopefully you can help me. What I’m trying to do is have a player’s movement seperate from what the camera is looking at while having the direction you press to move the player rely on where the camera is looking at. For example, if you’re moving forward and you rotate the camera, the player wont actually move to the direction the camera is facing, rather he will only move relative to what direction you are pressing. If you have the player running backward, release the direction, rotate the camera so that its facing the direction you’re running, as soon as you press forward, you will continue going in that direction rather than it read backward. If anyone can understand what I’m trying to say and can even help, I would greatly appreciate it. Thank you very much.

Did you ever resolve this? I too am looking for a way to have the camera controlled with the mouse while the player movement is controlled with the keyboard.

Unfortunately I never figured this out.

Hello,
A better definition of keys effect would help figuring it : up key : moving forward, down key : rotate 180, left right : rotate 90 (and wasd), mouse as usual around player ? Wheel distance player camera ?

Your character can move separately from camera if you not using camera orientation when add movement input.

If you look in character BP for third person template, you can notice that it use controller rotation for movement input direction.

You can remove it and use direction specified by yourself.

Also you should check “Orient Rotation To Movement” in character properties, if it’s not set.

That’s one part of the problem as a whole.

The second part is moving toward the camera orientation when actually moving. In the third person template, you move with the camera even when movement isnt being input.

I’m trying to figure out how to add movement toward camera direction when inputting but continue with momentum toward the direction you’re already going regardless of camera when movement input isnt being added.

I really can’t understand what are you talking about.
Can you provide any video with similar game mechanics?

Do you mean like a Resident Evil/Biohazard-style static camera with a movement system relative to said camera? Obviously when the camera changes its position, you don’t want the player to have to quickly move the joystick to the new direction to avoid going back the way they came. Silent Hill 2’s 2D movement mode solved this.

I had to solve this myself in Unity a while back. Instead of making the player move in relation to the Camera, I have the player move in relation to an empty object with a transform component. Its starts having the same orientation /location as the camera, but as long as the player is holding a joystick direction, this does not change. This allows for the camera to change position and orientation but the player can keep the joystick held in the same direction. When the joystick is released or moved an appreciable amount in a different direction, this empty game object then snaps to the new camera transform.

>Game Initialized, Camera Relativity Controller (CRC) is given Camera’s transform.
>Player Enters trigger that changes Camera’s transform.
>Trigger sends message to CRC that the camera’s position has changed.
>CRC remains at its original transform, but now checks at an interval to see if the input values from the joystick change by an appreciable amount.
>Player lets go of the joystick or intentionally moves in a different direction
>CRC snaps to Camera’s new transform
>CRC stops checking for player’s input

I know I’m trying to make it sound much more complicated but what I’m really aiming for is a camera like normal 3rd person camera systems. You hold forward and its forward based on the camera. If your character has momentum and you stop pressing forward to go forward, the character will continue going in that world direction regardless if you move the camera or not. Basically when you ARE inputting direction, its based on the camera. When you’re not inputting direction, your movement wont be changed by a camera move.

The solution is pretty simple really, you gotta find the forward vector of the camera, not the player. So if you have a camera locked in space, it will know which axis to move on through by its POV. So in my case i have a blueprint that has a camera, with a trigger box and thats how, when the player overlaps it changes to the camera of that blueprint for the new view. I then send a message to the playerblueprint, and let it know if the player is inside the camera. If it is…then use the camerage manager forward vector.

Well I know this is an old thread, but I think the final answer is quite a complicated way to do this, and I’ve seen this question many times, but I’ve never seen my answer, which I like, so I think other people should like it too.
My version is quite universal, as far as I can tell. It’s the actual default “Movement Input” block (in the ThirdCharacter event class), but just modified to change the “Get Control Rotation” node to “Set Camera Rotation” with a “Get Player Camera Manager”. If you want to have some multiplayer features, don’t forget to change the default player index value in the “Get Player Camera Manager” node to something like the actual player index.

Here is one screenshot. It works like a charm!
[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_135701_1524176384762_169”}[/ATTACH]
https://forums.unrealengine.com/core/image/gif;base64

2 Likes