#Smooth dashes in my battlegrounds game

1 messages · Page 1 of 1 (latest)

dark shard
#

I'm trying to make smooth dashes for my Battlegrounds game and I followed Ludius's tutorial (with some minor changes). I do have some issues though like dashing in air makes the player float and while in the air the players velocity gets halted near the end of the dash (as seen in the video)

#

Here is my script:

    if Knit.GetService("StateService"):GetState("Stunned") then return end
    local hrp: Part = player.Character:FindFirstChild("HumanoidRootPart")
    
    local dv = Instance.new("BodyVelocity")
    dv.MaxForce = Vector3.new(10000, 10000, 10000)
    dv.Parent = hrp
    
    local dashStrength = 100
    local minimumDashStrength = dashStrength * 0.15
    local amountOfIterations = DashController.DashDuration / DashController.Rate
    local removalOfStrengthPerIteration = dashStrength / amountOfIterations
    
    for _, part in player.Character:GetChildren() do
        if part:IsA("BasePart") then
            part.Massless = true
        end
    end
    
    for i = 0, DashController.DashDuration, DashController.Rate do
        local forwardVector = workspace.CurrentCamera.CFrame.LookVector
        local targetRotation = math.atan2(forwardVector.X, forwardVector.Z) + math.pi
        hrp.CFrame = CFrame.new(hrp.Position) * CFrame.Angles(0, targetRotation, 0)
        
        if dashDirection == "Front" then
            dv.Velocity = hrp.CFrame.LookVector * dashStrength
        elseif dashDirection == "Back" then
            dv.Velocity = (hrp.CFrame.LookVector * -1) * dashStrength
        elseif dashDirection == "Right" then
            dv.Velocity = hrp.CFrame.RightVector * dashStrength
        elseif dashDirection == "Left" then
            dv.Velocity = (hrp.CFrame.RightVector * -1) * dashStrength
        end
        
        if dashStrength > minimumDashStrength then
            dashStrength -= removalOfStrengthPerIteration
            
            if dashStrength < minimumDashStrength then
                dashStrength = minimumDashStrength
            end
        end
        
        task.wait(DashController.Rate)
    end
    
    for _, part in player.Character:GetChildren() do
        if part:IsA("BasePart") then
            part.Massless = false
        end
    end

    dv:Destroy()
#

I'm assuming my 1st issue is something to do with part.massless

dark shard
#

Smooth dashes in my battlegrounds game

urban sail
dark shard
urban sail
#

it works i believe the same as bodyvelocity but it's a bit better?

#

it has 3 different modes for the velocity

#

lemme find the documentation and send it to u

#

also keep forcelimitsenabled as false it's a bit buggy

dark shard
urban sail
#

Or at least in my experience it's a bit weid

#

It's simpler than u think though