Dash using CFrames isn't going well

The dash kinda works, here’s how it looks like:


Now you can clearly see what the issue is, the character is displaced and it looks almost like you’re teleporting and obviously, no one wants this garbage in their game.

Here’s the code that I’ve written that got me that result:

function Default.Dash(player: Player)
	local character = player.Character or player.CharacterAdded:Wait()

	local root = character:FindFirstChild("HumanoidRootPart") :: BasePart
	local human = character:FindFirstChildOfClass("Humanoid")


	if not root or not human then
		return
	end

	if connection then
		connection:Disconnect()
		connection = nil
	end

	connection = RunService.RenderStepped:Connect(function(dt)
		local velocity = root.CFrame.LookVector * 80
		local gravityVector = (human.FloorMaterial~=Enum.Material.Air) and Vector3.new(0,0,0) or workspace.Gravity

		velocity = velocity + Vector3.new(0, -gravityVector*dt, 0)
		root.CFrame = CFrame.lookAt(root.Position + velocity*dt, root.Position + (velocity * Vector3.new(1,0,1)))
	end)

	task.delay(.3, function()
		if connection then 
			connection:Disconnect()
			connection = nil
		end
	end)
end

Now the reason I’m using CFraming for dashing, is because I think I have a lot more control with this, and generally just to test and play around with stuff so I can learn.

Does anyone know how I could fix this issue, if so, please help!

1 Like

this was funny to read ngl :joy:

Dude why dont you use lerp to make it not look so

garbage

1 Like

I just don’t like using lerp functions and this can work so well if done correctly, do you have any other idea how I can fix this up?

1 Like

Well maybe try Tweening then because there really no other way to not make it look jumpy without smoothening it

You could always try to hide it with fancy visual effects

Use a LinearVelocity. Much easier to use that messing around with CFrames when you don’t need to.

1 Like