I’m trying to implement dashing and the biggest issue I’m facing is that an air dash goes much further compared to a grounded dash.
I’ve tried messing around with linear velocity to apply a force in the opposite direction as well as trying to make my own air resistance to try and slow them down, but nothing has worked/been accurate.
local root = model.model.HumanoidRootPart
local speed = 25
local dashSpeed = 200
local rotationSpeed = 1
-- Dashing (temporary code for testing)
for _, inputObject, gp in Matter.useEvent(UIS, "InputBegan") do
if inputObject.KeyCode == Enum.KeyCode.Z then
root.Velocity = root.CFrame.LookVector * dashSpeed
end
end
local moveDirection = Vector3.new(horizontal,0,vertical)
-- Movement and Rotation
if moveDirection.Magnitude > 0.5 then
root.CFrame += moveDirection.Unit * speed * Matter.useDeltaTime()
local goal = CFrame.new(root.CFrame.Position, root.CFrame.Position + moveDirection.Unit)
root.CFrame = root.CFrame:Lerp(goal, rotationSpeed)
end