How can I make a Vector3Value match up with the lookVector of the camera?

I have recently been scripting a custom character controller discarding Roblox’s default character controller.
I have set up a moveDirection and want the move direction to mach up with the direction of the camera
ex.

dependent on the direction of the camera is concluding what direction forward is.
here is my moveDirection code only working for 1 camera angle

	if table.find(inputs, Enum.KeyCode.W) and not W_ then
			moveVector.Value = moveVector.Value - Vector3.new(0, 0, 1)
			W_ = true
		elseif not table.find(inputs, Enum.KeyCode.W) and W_ then
			moveVector.Value = moveVector.Value + Vector3.new(0, 0, 1)
			W_ = false
		end
		
		if table.find(inputs, Enum.KeyCode.A) and not A_ then
			moveVector.Value = moveVector.Value - Vector3.new(1, 0, 0)
			A_ = true
		elseif not table.find(inputs, Enum.KeyCode.A) and A_ then
			moveVector.Value = moveVector.Value + Vector3.new(1, 0, 0)
			A_ = false
		end
		
		if table.find(inputs, Enum.KeyCode.S) and not S_ then
			moveVector.Value = moveVector.Value + Vector3.new(0, 0, 1)
			S_ = true
		elseif not table.find(inputs, Enum.KeyCode.S) and S_ then
			moveVector.Value = moveVector.Value - Vector3.new(0, 0, 1)
			S_ = false
		end
		
		if table.find(inputs, Enum.KeyCode.D) and not D_ then
			moveVector.Value = moveVector.Value + Vector3.new(1, 0, 0)
			D_ = true
		elseif not table.find(inputs, Enum.KeyCode.D) and D_ then
			moveVector.Value = moveVector.Value - Vector3.new(1, 0, 0)
			D_ = false
		end
		
		VEL.Velocity = moveVector.Value * 10 -- camera???

Any solutions?

have a good day or night : D thanks!

If I understand correctly based on the picture, you want the camera to always be anchored behind the moveDirection?

Why not use RenderStepped to constantly set the CFrame of the camera to the moveDirection’s position and directon and then multiply it by something like CFrame.new(0, 0, -5) to move it 5 studs back?

Let me know if I completely misunderstood

Talkin’ about Camera.CFrame.Lookvector

How would I make the lookvector always go forward, left, right, backwards based on the directions on the X and Z the camera can look in.

To alter the lookVector, you just alter the CFrame of the camera itself

So, if you want the camera to face left, do:

camera.CFrame = camera.CFrame * CFrame.Angles(0, -math.rad(90), 0)

If you want it right:

camera.CFrame = camera.CFrame * CFrame.Angles(0, math.rad(90), 0)

Backwards:

camera.CFrame = camera.CFrame * CFrame.Angles(0, math.rad(180), 0)

That is how you would alter the Camera’s lookVector. The lookVector will change to reflect its new direction once any one of these are called

I mean not dependent on the angle the actual direction of the velocity

I was thinking more

		local lookVector	= Camera.CFrame.lookVector
		lookVector			= Vector3.new(lookVector.X, 0, lookVector.Z).Unit
		local floorCFrame	= CFrame.new(Vector3.new(), lookVector)
		
		--VEL.Velocity = Camera.CFrame.LookVector * moveVector.Value * 10
		targetVelocity = floorCFrame:vectorToWorldSpace(moveVector.Value * SPEED)
		
		VEL.Force = moveVector.Value * (targetVelocity - char.HumanoidRootPart.Velocity) * MASS

NVM I solved it

		local lookVector	= Camera.CFrame.lookVector
		lookVector = Vector3.new(lookVector.X, 0, lookVector.Z).Unit
		local floorCFrame	= CFrame.new(Vector3.new(), lookVector)
		
		--VEL.Velocity = Camera.CFrame.LookVector * moveVector.Value * 10
		targetVelocity = floorCFrame:vectorToWorldSpace(moveVector.Value * SPEED)
		
		VEL.Velocity = targetVelocity * MASS

feel free to use my code! : D