use crate::components::{PhysicsConfig, PropBody, RigidBody, TriggerVolume};
use crate::ecs::PipelineContext;
use crate::resource::SkinnedMeshTable;
pub(super) fn inject(ctx: &mut PipelineContext) {
if ctx.query::<PhysicsConfig>().next().is_some() || !has_physics_content(ctx) {
return;
}
ctx.push(PhysicsConfig::default());
}
fn has_physics_content(ctx: &PipelineContext) -> bool {
ctx.query::<RigidBody>().next().is_some()
|| ctx.query::<PropBody>().next().is_some()
|| ctx.query::<TriggerVolume>().next().is_some()
|| ctx
.resource::<SkinnedMeshTable>()
.is_some_and(SkinnedMeshTable::has_capsule)
}