How to take input and rotate player relative to camera location

Hi

I have been struggling with this for a few days so thought I’d ask here! Thanks in advance!

When I move the right stick ‘down’ I want the character to be facing the camera location. If I move the right stick ‘up’ I want the character to face directly away from the camera, and then right/left/any other direction to be in relation to these.

Right stick gives me X and Y values between -1 and 1.

I have attached a screenshot below to show how I am using these to set the Control Rotation. However, this is an absolute value, so ‘down’ will always make them face on X regardless of where the camera is.

How can I rotate the character relative to where the camera is?

Thanks

245377-inputs.png

I don’t know if you found your answer, but since this is the first hit returned when you google that question I’ll provide and answer for posterity:
By far the easiest way of achieving camera relative movement is to multiply your input values by an absolute RightVector and ForwardVector. However if you take the Camera Forward Vector, depending on pitch, the returned vector will point either down or up. So to fix this issues you put the Camera as a child of another SceneComponent, I would recommend a SpringArm, as it offer neat feature for your camera.

The camera Rig

324137-capture.png

In this rig you can Pitch or Roll the Camera it self, but dot not rotate it directly. Instead you rotate the SpringArm (here named CameraArm) on it’s Z axis. It’s the SpringArm ForwardVector and RightVector we’ll want for multiplying our Input values. One neat trick when using this setup is that you can multiply the Camera ForwardVector with (1 - desiredDistance) for a quick zoom setup.

Once you have the setup you’ll be able to multiply the SpringArm ForwardVector with the forward Input value and Add it to a new Direction vector (the direction vector needs to start at zero or else the input value would add up overtime creating undesired movements). You do the same with the Right input and SpringArm RightVector.

Here’s a generic example of blueprint you can use:

and don’t forget to use that direction vector: (Notice that I reset the DirectionVector to zero!)