Hello, I would like some tips & feedback on how to improve my dash.
Currently it feels slow and it also has an issue when dashing towards solid surfaces as shown in the video. Don’t mind that I don’t have an animation for dashing yet tho…
Here is my current dash code:
local function ApplyHighlight(t: number)
local DashHighlight: Highlight = replicatedStorage.Assets.DashHighlight:Clone()
DashHighlight.Parent = Character
task.delay(t, function()
DashHighlight:Destroy()
end)
end
local function CreateVelocity()
local Attachment: Attachment = Root:WaitForChild("RootAttachment")
local Velocity: LinearVelocity = Instance.new("LinearVelocity")
Velocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
Velocity.Attachment0 = Attachment
Velocity.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
Velocity.ForceLimitsEnabled = true
Velocity.ForceLimitMode = Enum.ForceLimitMode.PerAxis
Velocity.MaxAxesForce = Vector3.new(math.huge, 0, math.huge)
if inputService:IsKeyDown(Enum.KeyCode.W) then
Velocity.VectorVelocity = Vector3.new(0, 0, -25)
elseif inputService:IsKeyDown(Enum.KeyCode.D) then
Velocity.VectorVelocity = Vector3.new(25, 0, 0)
elseif inputService:IsKeyDown(Enum.KeyCode.A) then
Velocity.VectorVelocity = Vector3.new(-25, 0, 0)
else
Velocity.VectorVelocity = Vector3.new(0, 0, 25)
end
Velocity.Parent = Root
ApplyHighlight(0.5)
task.delay(0.5, function()
Velocity:Destroy()
end)
end
Please feel free to criticize my code and give me tips & ideas about my dash in general
I think the issue might be that your Velocity.MaxAxesForce are set to math.huge for your x and z axis. This means that the linear velocity will exert as much force as it can to keep your player moving at that speed. If you set your math.huge to a smaller number it might stop the player from being flung when dashing into objects. Also if you want it to be faster you can edit your
Anyway, @realdeivanna, the more force that’s used to maintain a constant velocity, the more your character will act weird when it hits other objects (like flinging). To limit this, you dont want the maximum force used to be infinite. To increase speed just increase the vector velocity numbers