Video above shows that when I “Dash” and my MoveDirection is ~ 0, 0, 1 I will cover far less distance then when I dash on a diagonal in between the axis.
I’ve tried replicating it with 2 parts but they both move at the same speed, not like what I’m seeing when using the character.
I’m really not sure what’s happening, any help is greatly appreciated.
Code is below:
local velocity = Instance.new("LinearVelocity")
velocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
velocity.ForceLimitsEnabled = true
velocity.ForceLimitMode = Enum.ForceLimitMode.PerAxis
velocity.MaxAxesForce = Vector3.new(10000, 0, 10000)
velocity.Attachment0 = hrp.RootAttachment
velocity.Parent = hrp.RootAttachment
local strength = 150
local minStrength = strength * 0.15
local iterations = duration / rate
local removalPerIteration = strength / iterations
for i = 0, duration, rate do
if hum.MoveDirection == Vector3.new(0, 0, 0) then
print("Using Last Direction")
velocity.VectorVelocity = lastDirection * strength
else
print("Using Move Direction")
lastDirection = hum.MoveDirection
velocity.VectorVelocity = (hum.MoveDirection) * strength
end
print("Velocity: ", velocity.VectorVelocity)
print("Strength: ", strength)
if strength > minStrength then
strength -= removalPerIteration
if strength < minStrength then
strength = minStrength
end
end
task.wait(rate)
end
velocity:Destroy()
Try setting your MaxForce of the LinearVelocity on the X and Z axes to inf or just a really big number so that they take control over the assembly’s velocity completely instead of letting it be influenced by things like friction. For example, if you keep your current solution and try jumping while dashing, you’ll also see you’ll go farther & faster because you are not grounded.
You may have to adjust your strength values after.
If so, use humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false), preferably before they can dash at all (e.g. when they spawn), and you only need to do it once unless you enable it again.
Nope, the character just goes flying away when using a massive number, but falls on the floor when using something like 75000-100000. This is the same even when using the SetStateEnabled thing.