So the LinearVelocity dashes in the correct direction, however I can’t seem to get the player to face in the direction they are dodging.
Here is the code for facing the character:
HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.Position, Vector3.new(DodgeVelocity.X, 0, DodgeVelocity.Y) * 1000)
And here is the code for getting the velocity direction:
function GetDodgeVelocity()
local VectorMask = Vector3.new(1, 0, 1)
local Direction = HumanoidRootPart.AssemblyLinearVelocity * VectorMask
if (Direction.Magnitude <= 0.1) then
Direction = CurrentCamera.CFrame.LookVector * VectorMask
end
Direction = Direction.Unit
local VelocityDirection = Vector3.new(Direction.X, 0, Direction.Z)
local DodgeVelocity = VelocityDirection * DodgeSpeed
return DodgeVelocity
end
Here is en example of what I mean:
https://gyazo.com/6a938fee1ff58682a4443a3195932739
How would I get the player to face in the same direction as they are dashing?