Need help with translating a directional vector to be relative to the camera's LookVector

Hello!

Basically I’m wondering how I would go about translating the player’s MoveVector to be relative to the camera, particularly for mobile controls?

Some background, Roblox’s control module allows you to get the MoveVector of a player which is useful for getting the direction the player is moving in when using mobile controls. The issue I’m facing, though, is that the vector is the same regardless of the camera’s orientation.

So basically, if your thumbstick was facing directly up, the MoveVector would be 1,0,0, regardless of what direction the camera is facing. So what I need to do, somehow, is factor in the camera’s LookVector to find what direction they should be moving in. The issue though, is that I don’t know how to translate the player’s MoveVector to the camera’s LookVector if that makes sense.

Here’s a diagram:

Just edit a little bit the Move module in PlayerModules
Pretty sure you can make a desired camera cframe somewhere there

The issue is that the player can move their camera around, the direction that the player is trying to move and camera and its direction can vary. Modifying the move module is also not really useful in this case because I’m using a BodyAngularVelocity to move the player inside of a marble instead of normal movement.

Sorry for the bump but I’m still having this issue.

Bump again, still haven’t been able to figure it out.

This is what you are looking for if you still need it

local Camera = workspace.CurrentCamera
local InputVector = ControlModule:GetMoveVector()

if InputVector.Magnitude == 0 then
     return Vector3.new()
end

local InputForward = -InputVector.Z
local InputRight = InputVector.X
local CameraForwardVector = Camera.CFrame.LookVector
local CameraRightVector = Camera.CFrame.RightVector
local MoveVector = ((InputForward * CameraForwardVector) + (InputRight * CameraRightVector)).Unit