Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Dodge Roll

Discussion in '2D' started by elgatodorado, Aug 17, 2019.

  1. elgatodorado


    Apr 7, 2019
    I'm making a platformer 2d game and I couldn't find how to do a dodge roll that can cross enemies.

    Can someone give an example? Or if you know a tutorial can you share it to me?

    All tutorials I could find explain how to do a dodge roll but not how to avoid collision with enemies with the dodge.

    Thank you for your time.
  2. Vryken


    Jan 23, 2018
    Simply disable the player character's collider at the beginning of the roll and enable it again at the end of the roll.

    To prevent the character from falling through the world, don't use the same collider for colliding with terrain and enemies.
    Use two separate colliders and have them collide with different layers: one for terrain, and one for enemies.