Search Unity

Knockback without going through walls

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

  1. Pixitales

    Pixitales

    Joined:
    Oct 24, 2018
    Posts:
    180
    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:
    7,238
    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:
    180
    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:
    180
    Already did tried that. Instead I set boundaries and restrict movement. It works like a charm.
     
unityunity