I'm making a custom movement system (the character is just a part) and I'm running into issues when colliding with a wall. I've tried running it on both RunService.Stepped and RunService.Heartbeat and it makes no difference. My main idea was to get any collisions and get the collision normal, then apply the opposite force to the player, but there seems to be no way to get the collision normal in Roblox. Any ideas?
RunService.Stepped:Connect(function(elapsed, delta)
local inputAxis = Vector2.new(0, 0)
if UserInputService:IsKeyDown(Enum.KeyCode.W) then inputAxis += Vector2.yAxis end
if UserInputService:IsKeyDown(Enum.KeyCode.A) then inputAxis -= Vector2.xAxis end
if UserInputService:IsKeyDown(Enum.KeyCode.S) then inputAxis -= Vector2.yAxis end
if UserInputService:IsKeyDown(Enum.KeyCode.D) then inputAxis += Vector2.xAxis end
if inputAxis.Magnitude ~= 0 then inputAxis = inputAxis.Unit end
local direction = Vector3.new(inputAxis.Y, 0, inputAxis.X)
direction = rotateVectorAround(direction, Vector3.yAxis, Camera.CFrame.Rotation.Y)
movementVelocity = movementVelocity:Lerp(direction * speed, math.clamp(smoothing * delta, 0, 1))
PlayerObject.AssemblyLinearVelocity = movementVelocity + velocity
PlayerObject.AssemblyAngularVelocity = Vector3.new(0, 0, 0)
end)