I have this momentum code and when you are mid air and press a movement key the momentum force gets paused mid air since the humanoid movement force overlaps the momentum force
local function ApplyMomentum(dt)
local vel = GetHorizontalVelocity()
local moveDir = Camera.CFrame:VectorToWorldSpace(controlModule:GetMoveVector())
local isAirborne = Humanoid.FloorMaterial == Enum.Material.Air
if not isAirborne then
-- controlModule:Enable(true)
end
if isAirborne then
--controlModule:Disable()
local desired = vel
if moveDir.Magnitude == 0 and LastGroundVel then
desired = Camera.CFrame:VectorToWorldSpace(LastGroundVel)
end
if moveDir.Magnitude > 0 then
desired = vel + (moveDir * CharacterSettings.AirControl * dt)
end
desired = ClampMagnitude(desired, CharacterSettings.MaxAirSpeed)
HumanoidRootPart.AssemblyLinearVelocity = Vector3.new(
desired.X,
HumanoidRootPart.AssemblyLinearVelocity.Y,
desired.Z
)
else
--controlModule:Enable(true)
LastGroundVel = Camera.CFrame:VectorToObjectSpace(vel)
end
end