Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Problem when you crouching below the obstacle

Discussion in '2D' started by NjordNystrom, Jun 29, 2018.

  1. NjordNystrom

    NjordNystrom

    Joined:
    Feb 29, 2016
    Posts:
    25
    Hello friends, i use raycast only when i going the direction. For instance when i press jump key UPPER RAYCAST LINES appear, when jumping over and falling start BOTTOM RAYCAST LINES appear. If you press D to walk right (+axis) BOTTOM(Groundhit) and RIGHT RAYCAST LINES appear. The problem is how can i understand there is a obstacle when i m crouching below the obstacle.

    https://imgur.com/a/SCByGlg
     
  2. NjordNystrom

    NjordNystrom

    Joined:
    Feb 29, 2016
    Posts:
    25
  3. Thorlar

    Thorlar

    Joined:
    Oct 7, 2017
    Posts:
    28
    ? I don't really get what you are saying, but raycasting upwards when crouching should work?

    I guess you want it so player stops crouching, so if player stops crouching, do a raycast upwards, and get the distance from it. If the distance is large enough for the player to stand up, player stands normally, otherwise he keeps crouched?

    Could you give more information? or even the code sample of crouching :p