Best way to make a dash system WITHOUT BodyVelocity/etc?

Hello! I’m making a Dark Souls-style dodge roll, but I’m having trouble figuring out a way to go about it without using BodyVelocity, and similar. The reason why I don’t want this is because of the ground friction and the mass of the character can heavily impact how far you go, and I would like a more consistent approach. Any help would be appreciated!

3 Likes

Your best bet is to probably use CFrames and stuff. This is just my opinion btw

1 Like

You could try using ApplyImpulse, very easy and simple to use and gives good outcomes:

local DashKey = Enum.KeyCode.Q (Custom key)
local Impulse = 300 --Can vary from 100-1000 (more or less gives bad results..)
local plr = game.Players.LocalPlayer
local chr = plr.Character or plr.CharacterAdded:Wait()
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input)
if input.KeyCode == DashKey then
chr.PrimaryPart:ApplyImpulse(chr.PrimaryPart.CFrame.LookVector*Impulse)
end
end)

Now of course this is very simple because it has some problems:

  • If the player is in the air they get flung (Easy fix)
  • You can spam it (Also super simple)
  • Doesnt have any animations and looks very bad

I could solve these problems but that way you wouldn’t learn anything while waking the dash…

2 Likes

BodyPosition, with BodyGyro and Raycasting to make a realistic looking dash that feels natural and not weird like Velocity dash.

As far as consistency, I think that using CFrames is one of the best ways to go, like @Doomcolp said.
I did test @shadowbendy123’s method, and it is rather fun because when you bump into an object, like a wall, you bounce off of it, which could be cool for many games. But, ApplyImpulse() does rely on mass.
Also BodyPositions and BodyGyros are deprecated. Instead, you should use their ultimate alternatives AlignOrientation and VectorForceVectorForce is the alternative for BodyThrust and BodyForce, which are both deprecated alternatives to BodyPosition.

Adding on to @lV0rd’s raycasting idea, when making a dash system, when directly using CFrames rather than physics to move the character, you should make sure that the character won’t intersect with anything.
For example, let’s say you’re in front of a wall that is ten studs away from you, and you dash ten studs in front of you, you will intersect with the wall. If you dashed twenty studs in front of you, depending on the length of the wall, you might even go through the wall, not just inside the wall.

So, before dashing, you should Raycast(). If there’s an intersection, only dash the distance between the origin of the ray and the intersection point–using RaycastResult.Distance–and, depending on your preference, you can even apply an offset, like five studs, so that the character only gets so close to the intersection point.

1 Like

Wow, since when were they deprecated? Dang I’m old I gotta update my scripts then

1 Like

AlignPosition and AlignOrientation with a OneAttachment Mode and LooKVector to get the new position, maybe shoot a raycast to prevent it going into a wall. But this is the best solution by far and it’s reliable

1 Like

Hey. I think that maybe he can add a body velocity and delete it after a certain amount of time. To figure this time value, we need to shoot a ray and find its magnitude ( length ) Then we use a simple formula to find the time