How to make dash/dodge mechanics?

Background Information
Well, title…

Goal
I need to make a dodge mechanic. I already have the animations but I’m not sure about the best way to launch your character in a direction.

What I’ve tried

  • LinearVelocity/VelocityForce/Impulse
    The problem with this is that whenever I’m airborn it’ll send me much further compared to when I’m on the ground

  • TweenService
    Glitchy
    Uncontrollable

Linear velocity should do the trick.
What linear velocity does is force a part to have the exact velocity it is set at as long as it is enabled.
Having something like:

if Dodge == true then

LinearVelocity.Enabled = true
LinearVelocity.VectorVelocity = Vector3.new(10, 0, 0)
wait(2)
LinearVelocity.VectorVelocity = Vector3.new(0, 0, 0) --resetting the velocity will stop the player from flying--
wait(0.1)
LinearVelocity.Enabled = false

end

This happens because the ground has friction. You can bypass it temporarily by using custom physical properties.

local NoFriction = PhysicalProperties.new(0.7, 0, 0.5, 100, 1)
local copies = {}

--Settings No friction
for i,v in pairs(character:GetDescendants()) do
    if v:IsA("BasePart") then
        copies[v] = v.CustomPhysicalProperties
        v.CustomPhysicalProperties = NoFriction
    end
end

--Settings it back to default
for i,v in pairs(character:GetDescendants()) do
    if v:IsA("BasePart") then
        v.CustomPhysicalProperties = copies[v]
        copies[v] = nil
    end
end

You may need to tinker the values but this works for me. I’d change the Velocity of the pusher to something lower as this is pretty much close to no Friction. It will push you until you go too far, or until you set the friction back to default.

1 Like

Even after changing the friction it’s still much slower on ground than in the air

https://gyazo.com/681e02cccbfd333d4ee9b2183f826716

Turns out I had to change the PhysicalProperties of the baseplate rather than my character. Not sure why that is or if there’s a way to do it with just my character. The problem is that I’ll have to find which floor my character is running on and change those properties.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.