Problems with linear velocity when making a dash

Hello!

So basically i have this dash system that adds an attachment and linear velocity inside to the players humanoidrootpart for a split second and then deletes it.

It works for the most part, however there are 3 issues:

  • dash distance on the ground and mid air being VERY different (can technically be fixed by not letting the player dash mid air but thats lame)
  • bumping into walls could ragdoll or even fling the player
  • gravity doesnt affect the player for the split second linear velocity is active for

I tried looking for answers but most of them dont use linear velocity (i use it cause i was told its the best for dashes)

Any ideas on how to fix these? Any help would be greatly appreciated

I’m having the same issue too.

If one of you could post a rbxl file with the script that toggles the dash so I can try and fix it I’d be happy to try and help

I tried looking for answers but most of them dont use linear velocity (i use it cause i was told its the best for dashes)

Not really, maybe in some cases, but you’re generally better off setting the humanoidrootpart’s velocity.

Untested code, might be syntax errors, but i trust you get the idea.
(Also, this only does a right dash)

function Dash(Player: Model)
  local HRP = Player:FindFirstChild("HumanoidRootPart")
  local T = os.clock()
  while (os.clock() - T) < 0.4 do
    local Ratio =  1-((os.clock() - T)/0.4)
    print(Ratio)
    HRP.AssemblyLinearVelocity = vector3.new(0, HRP.AssemblyLinearVelocity.Y, 0) + (HRP.CFrame.RightVector * Ratio)
  end
end

The reason i don’t set the velocity once is precisely because of the midair dash issue. By constantly setting the velocity, the different in friction between the ground and air becomes meaningless.

ok i will once I get on my computer

sorry for the super late reply, here is the file:
OBG.rbxl (635.3 KB)

1 Like

You are going to be so happy when you see this :grin:

I fixed the linear velocity to make the players dash midair only instead of on the ground by changing the code to

lv.MaxAxesForce = Vector3.new(value, value, value)

I added a collision group changer that sets the players collision temporarily to noclip(Collides with nothing except for other noclip parts) into their head, torso, and root part and then switches it back to players once the velocity gets destroyed. This doesn’t come with any weird behavior so if they do end up inside of a wall, it will gently kick them out of the wall all the while still making sure that the player is actually going forward and that the dash is still a valuable feature to everyone who uses it.

Lastly I changed the first value in the for loop from 101 to 60 to make sure the dash is shorter because the map is small and that super long dash is too long for the specific map you created.

Linear Velocity Dash.rbxl (635.6 KB)

1 Like

alright I’ll see this once I come back from church and get on my computer

1 Like

i like the changes you made but i dont want dashes be able to noclip through buildings so ill make it collidable with default collision group

1 Like