How can I stop a LinearVelocity from messing with my character's orientation?

Hi,
Currently trying to create a proper dash mechanic for a game, however I am terrible with constraints. I have set up the dash so that it works, however it likes to slightly rotate the character for a second whenever it gets enabled, which gets much more pronounced if the dash is a long one. This is especially a problem when you dash on the ground:

Since I have like, never used these before I’m not quite sure what the problem is - the creator documentation isn’t super clear about a lot of things regarding these constraints too. Here is the script that is controlling all dash logic:

--!strict

local ContextActionService = game:GetService("ContextActionService")
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")

local player = Players.LocalPlayer
-- Since this is a StarterCharacterScript the character will always be the correct one
local character = player.Character
local rootPart = character:FindFirstChild("HumanoidRootPart")
local humanoid = character:FindFirstChildOfClass("Humanoid")

assert(rootPart:IsA("BasePart"))
assert(humanoid)

-- Create the proper LinearVelocity
local attatchment0 = Instance.new("Attachment")
local attatchment1 = attatchment0:Clone()

attatchment0.Parent = rootPart
attatchment1.Parent = rootPart

local linearVelocity = Instance.new("LinearVelocity")
linearVelocity.Attachment0 = attatchment0
linearVelocity.Attachment1 = attatchment1
linearVelocity.MaxForce = math.huge
linearVelocity.RelativeTo = Enum.ActuatorRelativeTo.World
linearVelocity.VectorVelocity = Vector3.one
linearVelocity.Enabled = false -- Set to true only when performing a move!! If set to true then the player cannot move on their own accord!

linearVelocity.Parent = rootPart

-- Function definitions for moveset
local ACTION_DASH = "Dash"
local DASH_KEYBIND = Enum.KeyCode.LeftShift
local DASH_DISTANCE = 100
local DASH_TIME = 0.1
local DASH_COOLDOWN = 0.5

local dashVelocity = DASH_DISTANCE / DASH_TIME

local dashDebounce = false
local dashReset = true
local lastDash = 0

local function dash(_, InputState: Enum.UserInputState, InputObject: InputObject)
    -- is the debounce active?
    -- is the UIS the correct one?
    if dashDebounce 
    or InputState ~= Enum.UserInputState.Begin then 
        return 
    end

    -- cooldown
    local timeOfRequest = tick()
    local delta = timeOfRequest - lastDash
    if delta < DASH_COOLDOWN then
        return
    end

    -- if in the air, only dash once
    if humanoid.FloorMaterial == Enum.Material.Air then
        if not dashReset then
            return
        end

        dashReset = false
    end

    dashDebounce = true

    lastDash = tick()
    local oldVelocity = rootPart.AssemblyLinearVelocity

    local dashDirection = if humanoid.MoveDirection ~= Vector3.zero then humanoid.MoveDirection else rootPart.CFrame.LookVector
    dashDirection = Vector3.new(dashDirection.X, 0, dashDirection.Z).Unit

    linearVelocity.VectorVelocity = dashDirection * dashVelocity
    linearVelocity.Enabled = true

    task.wait(DASH_TIME)

    linearVelocity.Enabled = false
    
    -- No Y velocity so things like jumps aren't maintained
    rootPart.AssemblyLinearVelocity = Vector3.new(oldVelocity.X, 0, oldVelocity.Z)

    dashDebounce = false
end

-- Register base moveset (may be changed by other abilities)
ContextActionService:BindAction(ACTION_DASH, dash, true, DASH_KEYBIND)

-- Connections
humanoid.StateChanged:Connect(function(_, newState: Enum.HumanoidStateType)
    if newState == Enum.HumanoidStateType.Landed then
        -- reset any once-in-air abilities
        dashReset = true
    end
end)

-- Unregister base moveset on death to not clog up ContextActionService
humanoid.Died:Connect(function()
    ContextActionService:UnbindAction(ACTION_DASH)
end)

Linear velocity in vector velocity mode applies the force at the attachment point.

You could try to put the attachment at the Center of mass using rootPart.CenterOfMass

Or you can use plane constraint mode to make Linear Velocity only work on the XZ plane (left right forwards backwards, but not up and down).

I was lead to believe that setting the parent of an attachment would also put it at the centre of mass?

This would work, however I want the dash to have no movement on the Y-Axis, so having it only work on XZ would cause the player to start falling mid-dash. I’ll try manually setting the position of the attachment.

Manually setting the position to rootPart.CenterOfMass yields the same results

If not you can also try the other modes like Line mode.

Would Line mode not have the same issue where the character is free to move on any other axis?

Maybe you should try it first, theres no documentation on how these modes work in detail as of the moment.

According to the guy he said it could work:

Maybe use line mode of linear velocity to control the y axis and plane mode to control the XZ axis.

Yeah, I tried it, still has issues with the character going silly mode or whatever

It looks like changing the MaxForce fixes that problem??? I really do not understand these constraints lol