Search Unity

Crouching and Sliding problem using raycast

Discussion in 'Scripting' started by NjordNystrom, Jun 13, 2018.

  1. NjordNystrom

    NjordNystrom

    Joined:
    Feb 29, 2016
    Posts:
    25
    Hello friends first of all im beginner at programmer. My problem is crouching and sliding. My player only has boxcollider2D. I use raycastline to detect collider etc. What should i do / What kind of ways i must follow for apply crouching / sliding. Does resizing boxcollider works? I'm try to learn basics.
     
    Last edited: Jun 13, 2018
  2. Ermiq

    Ermiq

    Joined:
    May 1, 2018
    Posts:
    11
    What the problem is actually?
    If you want your player not to trigger collision with raycasts then you can change your player's layer to IgnoreRaycast layer (in player's Inspector).
     
  3. NjordNystrom

    NjordNystrom

    Joined:
    Feb 29, 2016
    Posts:
    25
    Actually its not problem, im still thinking about how can i achieve this. Is resizing boxcollider a solution ?
     
  4. Ermiq

    Ermiq

    Joined:
    May 1, 2018
    Posts:
    11
    Oh, since you've edited your question, now I see.
    Yes, you can resize box collider to implement crouching. It's a commonly used method to do this.