Search Unity

Detecting proximity in a single direction

Discussion in 'Physics' started by Olafgarten, Sep 27, 2019.

  1. Olafgarten

    Olafgarten

    Joined:
    Dec 31, 2013
    Posts:
    3
    Hi,

    I am making a 2d top down game and I need to be able to detect the proximity of the walls from the front of a player (a sphere).

    What I mean is that imagine there was a straight line coming out of the front of the player. I want to find where that line intersects a wall.

    What would be the best approach for this?
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    CosmicGiant likes this.