avian3d/collider_tree/
diagnostics.rs

1use bevy::{
2    diagnostic::DiagnosticPath,
3    prelude::{ReflectResource, Resource},
4    reflect::Reflect,
5};
6use core::time::Duration;
7
8use crate::diagnostics::{PhysicsDiagnostics, impl_diagnostic_paths};
9
10/// Diagnostics for [collider trees](crate::collider_tree).
11#[derive(Resource, Debug, Default, Reflect)]
12#[reflect(Resource, Debug)]
13pub struct ColliderTreeDiagnostics {
14    /// Time spent optimizing [collider trees](crate::collider_tree).
15    pub optimize: Duration,
16    /// Time spent updating AABBs and BVH nodes.
17    pub update: Duration,
18}
19
20impl PhysicsDiagnostics for ColliderTreeDiagnostics {
21    fn timer_paths(&self) -> Vec<(&'static DiagnosticPath, Duration)> {
22        vec![(Self::OPTIMIZE, self.optimize), (Self::UPDATE, self.update)]
23    }
24}
25
26impl_diagnostic_paths! {
27    impl ColliderTreeDiagnostics {
28        OPTIMIZE: "avian/collider_tree/optimize",
29        UPDATE: "avian/collider_tree/update",
30    }
31}