bevy_xpbd icon indicating copy to clipboard operation
bevy_xpbd copied to clipboard

`SpatialQueryFilter` excluded entities should check against `ColliderParent`

Open dminikm opened this issue 9 months ago • 0 comments
trafficstars

I'm playing around with this library (and bevy in general) and hit an issue.

I'm attempting to create a character controller with a camera. I wanted the player collider to be offset a bit and couldn't find any other way than though making it a child of the parent.

"Player"
├ ... Some components
├ RigidBody
└ Children
  └ "Player Colliders"
    └ Collider

However, when running a shape casting query for the camera, the player exclusion is ignored, as the entity that gets reported as hit is the "Player Colliders" entity.

  let query_result = spatial_query.cast_shape(
      &Collider::sphere(0.3),
      player_transform.translation,
      Quat::default(),
      Dir3::new(-rotated).unwrap(),
      &ShapeCastConfig {
          ..default()
      },
      &SpatialQueryFilter::from_excluded_entities([player_entity]),
  );

I'll probably solve this for now by just creating the colliders on the Player without the offset.

dminikm avatar Feb 02 '25 18:02 dminikm