Godot script that allow use of Field of View in (currently) 2d game.
- Hight customizable
- Multiple targets
- Target defined by groups
- Precision can be defined
- Update delay (faster will use more cpu)
Can be installed from asset lib
- 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;
- 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
A complete how to use this plugin.