Search Unity

Knockback without going through walls

Discussion in '2D' started by Pixitales, Jun 8, 2019.

  1. Pixitales

    Pixitales

    Joined:
    Oct 24, 2018
    Posts:
    227
    Probably impossible, but just wondering if you guys have any solution for minimizing knockback not make the player pass through walls. Simple solution I found is making the wall colliders bigger, but what if you want thin walls? You probably have seen this a lot in speed runs games that players is able to somehow glitch their way and walk through walls/locked doors.
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,776
    I can suggest, to look into topics, on how bullets are dealt with. Or other fast moving objects.
     
  3. Pixitales

    Pixitales

    Joined:
    Oct 24, 2018
    Posts:
    227
    I looked into that before, but I try again. Raycast might work but i have about 200 characters in one map so probably not.
     
  4. vakabaka

    vakabaka

    Joined:
    Jul 21, 2014
    Posts:
    1,153
    In the inspector of the rigidbody try to change collision detection to continuous
     
  5. Pixitales

    Pixitales

    Joined:
    Oct 24, 2018
    Posts:
    227
    Already did tried that. Instead I set boundaries and restrict movement. It works like a charm.
     
  6. lucassivolella

    lucassivolella

    Joined:
    Jul 14, 2020
    Posts:
    6
    I'm looking for a solution for this problem as well.. any chances you can still explain how your solution works?