Velocity based dashing, is heightended while jumping

I use assembly linear velocity (applyimpulse) on the root part to launch the player, only issue: when jumping you get like 3x velocity. I don’t want you to gain that much velocity, on the dash when jumping. I do want the dash to retain velocity.

Final issue: Need velocity to retain longer, have no idea how to do this. i just want it to stay longer without increasing the speed.

No bodymovers or velocities since it’s a important mechanic to retain velocity.

As of rn im using body position to do the dash, if any issues arise i’ll write them here. maybe someone else has a better solution…

Could you send the math in the code or the section of code that calculates the dash velocity?

I’m not sure what other way you could do this without using an external forces.

I assume the original error is due to friction with the ground.

rn im using body position to do the dash,

My guess best would be:

  • Create a direction for the player to dash towards (this could be based off of the direction the player is currently facing, the direction the player is currently moving, based off of input whatever)
  • Multiply that vector by some distance
  • Set the body position’s position property to that point

IF the body positions “MaxForce” is high enough, then it should be able to overcome the friction problem - obviously, if the max force is too high, your character will be flung when it collides with something during the dash, so you’ll have to tinker a bit.

i fixed this 4 days ago, basically the ground has friction and air doesnt, so thats why the dash is faster on air

but removing the friction on every part is bad, so i used LinearVelocity, more complicated but this fix alot of problems

local velocity = Instance.new("LinearVelocity", HumanoidRootPart)
local attach = Instance.new("Attachment", HumanoidRootPart) --set both Velocity and attachment parents to HumanoidRootPart
		velocity.MaxForce = math.huge --dont worry
		velocity.Attachment0 = attach
		velocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
		velocity.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
		attach.WorldPosition = hrp.AssemblyCenterOfMass

if uis:IsKeyDown(Enum.KeyCode.W) then
			
			velocity.VectorVelocity = Vector3.new(0,0,30) --i prefer something like 30 and 50
		end

idk why linearvelocity fix this problem, i think because is not deprecated

I tried using linear, it did not disable the friction, is it because of my low maxforce?

edit: i literally just tried this, and it doesn’t work. maybe im doing it wrong.

Video:

Code: IGNORE THE BAD VARIABLES I JUST MADE THIS QUICKLY

local Dash = function()

	local Character = Player.Character
	if Character == nil then return end

	local SF = Character.SF
	local Cooldowns = Character.Cooldowns

	if SF:FindFirstChild("Stun") then return end
	if Cooldowns:GetAttribute("Dash") then return end

	Cooldowns:SetAttribute("Dash",true)

	task.delay(DashCooldown,function()
		Cooldowns:SetAttribute("Dash",nil)
	end)

	local Hum = Character.Humanoid :: Humanoid
	local Root = Character.HumanoidRootPart :: Part

	local MoveDirection = Vector3.new()

	local RootCFrame = Root.CFrame

	local Direction

	if UserInputService:IsKeyDown(Enum.KeyCode.W) then 
		MoveDirection = RootCFrame.LookVector
		Direction = "Front"
	elseif UserInputService:IsKeyDown(Enum.KeyCode.D) then
		MoveDirection = RootCFrame.RightVector
		Direction = "Right"
	elseif UserInputService:IsKeyDown(Enum.KeyCode.A) then 
		MoveDirection = -RootCFrame.RightVector
		Direction = "Left"
	elseif UserInputService:IsKeyDown(Enum.KeyCode.S) then 
		Direction = "Back"
		MoveDirection = -RootCFrame.LookVector
	else
		MoveDirection = RootCFrame.LookVector
		Direction = "Front"
	end

	local Velocity = Vector3.new(MoveDirection.X,0,MoveDirection.Z) * DashVelocity

	local BodyPosition = Instance.new("LinearVelocity")
	BodyPosition.MaxForce = math.huge
	BodyPosition.Attachment0 = Root.RootAttachment
	Velocity = Velocity
	BodyPosition.VectorVelocity = Velocity

	local NewDashSpeed = DashVelocity

	BodyPosition.Parent = Root
	task.wait(DashTime)


	BodyPosition:Destroy()

end

Final edit: I copied his code 1-1 and it still doesn’t work, it’s just less obvious since the distance is basically nothing

That’s the system im currently using, it works fine, i just prefer linear velocity instead.
The maxforce doesn’t overcome friction from what i’ve tested.

tsb also has the same problem, it’s just not very noticeable in there.

The current version is working, just asking for alternatives, since i don’t like body position, and would like to use linear velocity instead, (or bodyvelocity)

used a linear velocity and just added a divided version of the assemblylinearvelocity onto it.

maybe try to put this at 80000 or lower

Didn’t work, sadly. I don’t understand how a maxforce could possibly “overpower friction”, the force isn’t changing, it just doesn’t have a limit, the only thing i could imagine working is lowering the max force to where the air velocity is the same as the ground one, but i don’t know.

I’m not entirely sure if this would work, as I haven’t tested it myself, but if friction is the problem, instead of disabling friction on all parts, couldn’t you instead set the friction of the player to 0 for the duration of the dash with CustomPhysicalProperties?

That doesn’t work, since it only accounts for the thing it’s sliding on, not the thing it’s sliding with. I already tried this, and it didn’t work. and even if it did it would look bad since 0 friction makes it too zoomy.

The thing that it’s sliding with? is there anything dragging along the player? If so, can’t you set its friction to 0 as well? Or am I missing something?
For the zoomy part, I think you could just add some drag to make sure that it slows down.

1 Like

yes, what i mean by the thing “it’s sliding with” i mean the floor that the player is touching, you could set the friction of the interacted floor to 0, that is another solution so i’ll mark it as that. although i use body position as my solution instead.

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