avian3d

Module diagnostics

Source
Expand description

Diagnostics support for tracking physics timers and counters. Useful for profiling and debugging.

§Overview

Each physics plugin such as NarrowPhasePlugin and SolverPlugin is responsible for implementing its own diagnostics resource using the PhysicsDiagnostics trait and registering it using AppDiagnosticsExt::register_physics_diagnostics.

If the bevy_diagnostic feature is enabled and the [PhysicsDiagnosticsPlugin] is added to the app, these diagnostics will also be automatically written to the DiagnosticsStore resource.

If the diagnostic_ui feature is enabled and the PhysicsDiagnosticsUiPlugin is added to the app, a debug UI will also be available for displaying these diagnostics in real-time.

§Example

use avian3d::prelude::*;
use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins((
            DefaultPlugins,
            PhysicsPlugins::default(),
            // Add the `PhysicsDiagnosticsPlugin` to write physics diagnostics
            // to the `DiagnosticsStore` resource in `bevy_diagnostic`.
            // Requires the `bevy_diagnostic` feature.
            PhysicsDiagnosticsPlugin,
            // Add the `PhysicsDiagnosticsUiPlugin` to display physics diagnostics
            // in a debug UI. Requires the `diagnostic_ui` feature.
            PhysicsDiagnosticsUiPlugin,
        ))
        // ...your other plugins, systems and resources
        .run();
}

§Supported Diagnostics

The following diagnostics are available but not added by default:

Additionally, physics plugins may implement their own diagnostics that are enabled by default. These include:

Structs§

Enums§

Traits§