Issue with having movement relative to camera

Ok so I have rolling in my game. And I made it move relative to the camera.
Basically all I do is put a bodyvelocity in the character and set the direction to game.Workspace.CurrentCamera.CFrame.lookVector *,0,1)
I multiply it so that it does not include the Y value because obviously I dont want people rolling into the sky lol.
Anyways this causes an issue. If the camera is angled down or up the roll will be a lot slower since the lookvector is pointed away

Example of the issue:
How could I fix this? Any help is greatly appreciated!

I guess a better way to explain my issue.
How I can make direction always face straight
This direction:
turns into this direction:

I am trying to lose the angle on the direction pretty much. Hopefully that makes it easier for anyone trying to help.

Unitize the vector, I believe you are missing that one step after setting the yAxis to zero.

1 Like

Try this

local function getWalkDirectionWorldSpace()
	local walkDir = camera.CFrame:VectorToWorldSpace( getWalkDirectionCameraSpace() )
	walkDir *=, 1)

	if walkDir.Magnitude > 0 then 
		walkDir = walkDir.Unit

	return walkDir

Edit: Didn’t read the post above, my bad.

1 Like