Skip to main content

Module frustum

Module frustum 

Source
Expand description

Module for the drawing of Frustums.

Camera entities are spawned with a Frustum component, which describes a camera’s field of vision. With this module, a camera’s frustum can be drawn with gizmos. This is useful for debugging what a camera can see and what entities in the scene will be subject to the camera’s frustum culling, especially when combined with drawing Aabb gizmos.

There are two ways to enable gizmo drawing of a Frustum:

  1. The ShowFrustumGizmo component can be added to individual camera entities.
fn setup(mut commands: Commands) {
    commands.spawn((Camera2d, ShowFrustumGizmo::default()));
}
  1. Setting the FrustumGizmoConfigGroup configuration’s draw_all field to true will draw every frustum. Note that this will include drawing bevy_light SpotLight Frustums.
fn turn_on_frustum_gizmos(mut config: ResMut<GizmoConfigStore>) {
   config.config_mut::<FrustumGizmoConfigGroup>().1.draw_all = true;
}

Structs§

FrustumGizmoConfigGroup
The GizmoConfigGroup used for debug visualizations of Frustum components on entities
FrustumGizmoPlugin
A Plugin that provides visualization of Frustums for debugging.
FrustumGizmoSystems
Frustum Gizmo system set. This exists in PostUpdate.
ShowFrustumGizmo
Add this Component to an entity to draw its Frustum component.