Way to Make Y Rotation of Camera Not Affect rest of Custom Movement?

Hi, I’m using a custom movement system. My movement is based off the direction the camera is facing. So it looks a little something like this:

local MovementDirection = workspace.Camera.CFrame.Rotation * Direction

if MovementDirection == MovementDirection then
	Character.Position += Vector3.new(MovementDirection.X,0,MovementDirection.Z)
end

But when you start to look down it starts to slow down when going up and down but not left and right. Is there a way to avoid it or do I have to use a different method? It looks like this:
(Sorry for bad video quality I used roblox recorder. I’m pretty sure it should be enough to show the problem but tell me if I need to upload a better quality one)


Thanks in advance :smile:

Can you try this

local MovementDirection = (workspace.Camera.CFrame.Rotation * Direction * Vector3.new(1,0,1)).Unit

Also, this doesn’t make any sense

1 Like

Wow thanks It worked Perfectly. Also the

if MovementDirection == MovementDirection then

was for if Movement direction was NaN

1 Like