Inaccurate Dash Angles

Currently the dash angles for specifically my back and side dashes are inaccurate and are offset slightly:

I originally used BodyVelocity before switching to LinearVelocity, both of these have the same issue.
Every part on the Player Model is Massless except for the Torso and HumanoidRootPart.
No parts have “EnableFluidForces” Enabled.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- This is a snippet of code

			local bv = Instance.new("LinearVelocity")
			bv.ForceLimitMode = Enum.ForceLimitMode.PerAxis
			bv.MaxAxesForce = Vector3.new(100000, 0, 100000)
			bv.Attachment0 = character.HumanoidRootPart.RootAttachment
			bv.Name = "DashVelocity"
			bv.Parent = character.HumanoidRootPart

			if directionlock == "forward" then
				bv.VectorVelocity = humRootPart.CFrame.lookVector* (45)
			elseif directionlock == "left" then
				bv.VectorVelocity = humRootPart.CFrame.rightVector* (-45)
			elseif directionlock == "right" then
				bv.VectorVelocity = humRootPart.CFrame.rightVector* (45)
			else
				bv.VectorVelocity = humRootPart.CFrame.lookVector* (-45)
			end

I’m pretty sure HumanoidRootPart’s lookVector and rightVector can be tilted or rotated slightly by animations (or physics).

so, for the cframe you might want to ignore Y tilt

local rootCFrame = humRootPart.CFrame
local useThisCFrame = CFrame.new(
rootCFrame.Position,
rootCFrame.Position + Vector3.new(rootCFrame.LookVector.X, 0, rootCFrame.LookVector.Z)
)

It seems to be about the same, however interestingly it’s more random?

When on the ground it works perfectly fine

Experiment using camera CFrame instead of HumanoidRootPart, due to how roblox’s physics and animations work.

Or you can try turning this off, to prevent turning
humanoid.AutoRotate = false

OR
you can cache the dash direction and save it.

and you could also flatten the cframe even more

local rootCFrame = humRootPart.CFrame
local flatCF = CFrame.fromMatrix(
    rootCFrame.Position,
    Vector3.new(rootCFrame.LookVector.X, 0, rootCFrame.LookVector.Z).Unit,
    Vector3.new(rootCFrame.RightVector.X, 0, rootCFrame.RightVector.Z).Unit
)

CFrame.fromMatrix takes 3 vectors
(in this order, lookVector, rightVector and upVector)

or if you want to use camera

local camera = workspace.CurrentCamera
local cameraFlatCF = CFrame.lookAt(
    camera.CFrame.Position,
    camera.CFrame.Position + Vector3.new(camera.CFrame.LookVector.X, 0, camera.CFrame.LookVector.Z)
)

and final solution that just came in my head, that could be causing it

humRootPart.AssemblyLinearVelocity = Vector3.new(0, humRootPart.AssemblyLinearVelocity.Y, 0)

Tweaked around the with the cameraFlatCF, it works almost perfectly. I just needed to tweak the player model so the animation aligns with the dash direction.

Thanks for the help! I wish you luck on any future development endeavors.

1 Like

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