Having trouble with directions

I want my velocity to force the player to move backwards, and forwards correctly no matter where their torso is facing when they press the back / forth button.

Does anyone know how I can solve this? I’ve tried these methods:

-- Forwards
movement=CFrame.new(character.HumanoidRootPart.CFrame.p, character.HumanoidRootPart.CFrame.p + workspace.CurrentCamera.CFrame.LookVector).LookVector
-- Backwards
movement=CFrame.new(character.HumanoidRootPart.CFrame.p, character.HumanoidRootPart.CFrame.p - workspace.CurrentCamera.CFrame.LookVector).LookVector
-- Left
movement=-workspace.CurrentCamera.CFrame.RightVector
-- Right
movement=workspace.CurrentCamera.CFrame.RightVector

For forwards, and backwards the issue is that it goes upwards since my velocity has a maxforce on all axis e.g lua Velocity.MaxForce = Vector3.new(1,1,1) * 10000

just use humanoid.MoveDirection, its an xz-axis unitvector directly to where the camera is looking at

if for some reason your code requires that its disabled (for custom movement, for example) you could use humMoveDir = (camera.CFrame.LookVector * Vector3.new(1,0,1)).Unit for same effect

1 Like