[Enum.KeyCode.W] = Vector3.new(0, 0, -1),
[Enum.KeyCode.S] = Vector3.new(0, 0, 1),
[Enum.KeyCode.D] = Vector3.new(1, 0, 0),
[Enum.KeyCode.A] = Vector3.new(-1, 0, 0)
}
for key, force in pairs(forceTable) do
if keys[key] then
local horizVel = Vector3.new(vel.X, 0, vel.Z)
if horizVel.Magnitude < TOP_SPEED then
root:ApplyImpulse(force * root.AssemblyMass * ACCEL * dt)
end
end
end
local horizVel = Vector3.new(vel.X, 0, vel.Z)
if horizVel.Magnitude > 0.01 then
root:ApplyImpulse(20*-horizVel.Unit * root.AssemblyMass * FRICTION * dt)
end
local avatarCFrame = CFrame.new(ballPos + Vector3.new(0, root.Size.Y / 2, 0))
* CFrame.Angles(0, facingAngle, 0)
I'm working on a game and i'm working with push forces in different directions. I need friction to work, but the problem is that the friction only applies in the exact opposite direction of current movement making it so holding another direction slows down friction in every other direction. Is there a different approach i could take to this problem to solve this issue?