Search Unity

Dynamic Hitboxes.

Discussion in 'Scripting' started by sistercrystal, Aug 14, 2018.

  1. sistercrystal

    sistercrystal

    Joined:
    Jan 12, 2016
    Posts:
    10
    I have a invisible box (trigger) that detects a specific type of object. It follows the player. I'm having a problem that I need it to not detect the red blocks through walls.
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    Kurt-Dekker likes this.
  3. sistercrystal

    sistercrystal

    Joined:
    Jan 12, 2016
    Posts:
    10
    Okay, Thanks. I thought of that yesterday but I wasn't quite sure.
     
  4. sistercrystal

    sistercrystal

    Joined:
    Jan 12, 2016
    Posts:
    10
    Thanks!!!
     
  5. sistercrystal

    sistercrystal

    Joined:
    Jan 12, 2016
    Posts:
    10
    Help: The raycasting sometimes doesn't see it when it should.
     
  6. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I am not able to read your mind, can you add some background information.
     
  7. sistercrystal

    sistercrystal

    Joined:
    Jan 12, 2016
    Posts:
    10
    There is a player sphere and there are red blocks. I have a trigger that follows the player that detects red blocks and does raycasting to see if it's through walls but sometimes when you should activate it. It just won't activate.
     
  8. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    You need to narrow down why that is happening. Use Debug.Log so you can see if the code is taking the path you imagine it is. Or you could post some code. There is still insufficient information. I will add that if a raycast will not detect a collider it is overlapping at the origin.