Skip to content

Godot scritp that allow use of Field of View in (currently) 2d game (check README for details).

License

Notifications You must be signed in to change notification settings

luisboch/godot_field_of_view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Godot Field Of View

Godot script that allow use of Field of View in (currently) 2d game.

Features

  • Hight customizable
  • Multiple targets
  • Target defined by groups
  • Precision can be defined
  • Update delay (faster will use more cpu)

How to install

Can be installed from asset lib

How to use

  • Enable plugin under project settings
  • Add Field of View node
  • Configure it (And add target groups to track, without it, plugin will not work as expected!)
  • From Character node read "in_danger_area" and "in_warn_area" properties to get the visible nodes, or,
  • Use events "target_enter" or "target_exit" to work;

Configurations

  • View Detail: Int, Indicates the number of rays created to check the Fov area, greater value will be more precise with cpu cost.
  • Field of View: In degrees, configure the view angle
  • Warn distance: Float, view distance
  • Danger distance: Float, view distance to consider danger, must be lower than Warn distance
  • Show Fov: Bool, use to view the rays created
  • Show Target line: Bool, draw line to target?
  • Fov Color: Color, when Show Fov is true, this define the color used to draw rays
  • Fov Warn Color: Color, when Show Fov is true, this define the color used to draw rays when is "warn" state
  • Fov Danger Color: Color, when Show Fov is true, this define the color used to draw rays when is "danger" state
  • Frequency: Float, frequency to update view area, lower will update fast with cpu cost, default value is 0.5
  • Target Groups Array groups to track, required at least one.
  • Collision Mask

Current state

Screenshot 1

Screenshot 2

Screenshot 3

Screenshot 4

Screenshot 5

Screenshot 6

Screenshot 7

Screenshot 8

Previews:

Preview 1

Preview 2

Preview 3

Preview 4

How-To from zero

A complete how to use this plugin.

Youtube vídeo

About

Godot scritp that allow use of Field of View in (currently) 2d game (check README for details).

Resources

License

Stars

Watchers

Forks

Packages