Unity Field Of View Fog Of War by Kellojo - 3

Games & Projects

This code snippet can be used to achieve a stealth game like field of view. Thanks to Sebastian Lague (https://github.com/SebLague) for the implementation (https://github.com/SebLague/Field-of-View) of the field of view mechanic. Be sure to check out his tutorial series on the subject.

Unknown VersionMIT LicenseUpdated 2 years agoCreated on March 29th, 2018
Go to source

Unity—Field-of-View-Fog-of-War

This code snippet can be used to achieve a stealth game like field of view. Thanks to Sebastian Lague (https://github.com/SebLague) for the implementation (https://github.com/SebLague/Field-of-View) of the field of view mechanic.

Showcase

Added Peripheral Vision

Features

  • Field of view visualization
  • Edge revolsing
  • Tweakable field of view (radius and width)
  • Peripheral vision (tweakable radius and width)

How to use

  1. Add the “Field of View” prefab to your scene.
  2. Setup the “Target Mask” on the Field of View Component
  3. Setup the “Obstacle Mask” on the Field of View Component
  4. Add the “Hideable” component to the gameObjects that should be affected by the field of view

How to implement your own behaviour

Any MonoBehaviour that should be affected by the field of view needs to implement the IHideable interface which gives you the option to implement the “OnFOVEnter” and “OnFOVLeave” methods yourself.

Show all projects by Kellojo