Player gets launched when it's collider is enabled inside another collider

I’m working on dash ability, and I’d like the unity engine to take care of the object positioning after the collision is resolved.

My current approach is as following;

  1. I press the SPACE key to trigger ability
  2. I disable the collider of the player
  3. When dash reached the calculated position I then reenable the collider
    At that point, the collider is re-enabled inside another collider and the player gets launched into the opposite direction (sometimes it gets launched into World’s forward direction). I’ve attached a gif to illustrate the issue.

6540331--739414--ezgif.com-gif-maker (1).gif

Any ideas as to why this is happening?

6540331--739411--ezgif.com-gif-maker.gif

I’ve fixed this issue by setting rigidbody’s velocity rigidbody.velocity = Vector3.zero before re-enabling colliders.

Here’s the result:

6544333--740155--ezgif.com-gif-maker (2).gif