Only get the forward of a lookvector

so like, im making a character move forward by lookVector of the camera but i have a problem where if i loook down with the camera the character moves slower forward since its applying for downwards.

So how do i use the cameras lookvector without this happening?

Also this is how im getting the direction

move_direction = cam.CFrame.RightVector * hsp*playersettings.movementSpeed + cam.CFrame.LookVector * vsp*playersettings.movementSpeed 

vsp and hsp are just either 1 or -1 depending on what keys are pressed.
So like pressing w makes vsp 1 and pressing s makes vsp -1

try to use the lookvector of the camera relative to the root part of your character

Just modify the z position of the character. Also use HumanoidRootPart for these things.

Get rid of the downwards by getting rid of the y component.

*Vector3.nee(1, 0, 1)

Didint work.
Im doing

cam.CFrame.LookVector*Vector3.new(1, 0, 1)

i might be missing something but the problem is still there

You need to remove the Y component of your look vector and then normalize it. Try this

lookVector = camera.CFrame.LookVector
lookVector = Vector3.new(lookVector.X, 0, lookVector.Z).Unit
1 Like