Search Unity

How to highlight area that is NOT in the field of view rage of a GUN/CCTV Camera

Discussion in 'Physics' started by atifraheem48, Jul 24, 2021.

  1. atifraheem48

    atifraheem48

    Joined:
    Aug 24, 2019
    Posts:
    11
    Hi ,
    I want to highlight an area (in red color) that is NOT in the range of field of view due to some obstacle.
    I found tutorials that help to highlight the area inside the field of view but I need the inverse of that i.e Area that is not in the field of view should get highlighted.

    A small image is attached. In the provided image I need to highlight Red Area. Square is my obstacle, blue circle is my player and Yellow circle is the weapon range.
     

    Attached Files:

    • FOW.png
      FOW.png
      File size:
      8.2 KB
      Views:
      264
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,456
    This isn't a physics problem, it's more of a computational geometry problem. You can use libraries such as clipper to produce these kinds of outlines, calculate unions and perform geometry operations on them etc.

    There's certain no physics code that'll generate this for you unless you can narrow it down to an inherently physics related requirement.