Skip to main content

QueryFilter

Struct QueryFilter 

Source
pub struct QueryFilter<'a> {
    pub flags: QueryFilterFlags,
    pub groups: Option<CollisionGroups>,
    pub exclude_collider: Option<Entity>,
    pub exclude_rigid_body: Option<Entity>,
    pub predicate: Option<&'a dyn Fn(Entity, &Collider) -> bool>,
}
Expand description

A filter that describes what collider should be included or excluded from a scene query.

Fields§

§flags: QueryFilterFlags

Flags indicating what particular type of colliders should be excluded.

§groups: Option<CollisionGroups>

If set, only colliders with collision groups compatible with this one will be included in the scene query.

The CollisionGroups::test_mode of both groups is taken into account.

§exclude_collider: Option<Entity>

If set, the collider attached to that entity will be excluded from the query.

§exclude_rigid_body: Option<Entity>

If set, any collider attached to the rigid-body attached to that entity will be excluded from the query.

§predicate: Option<&'a dyn Fn(Entity, &Collider) -> bool>

If set, any collider for which this closure returns false will be excluded from the query.

The closure is given the collider’s entity and its Rapier collider, which gives access to its shape, position, parent, etc.

Implementations§

Source§

impl<'a> QueryFilter<'a>

Source

pub fn new() -> Self

A query filter that doesn’t exclude any collider.

Source

pub fn exclude_fixed() -> Self

Exclude from the query any collider attached to a fixed rigid-body and colliders with no rigid-body attached.

Source

pub fn exclude_kinematic() -> Self

Exclude from the query any collider attached to a kinematic rigid-body.

Source

pub fn exclude_dynamic() -> Self

Exclude from the query any collider attached to a dynamic rigid-body.

Source

pub fn only_dynamic() -> Self

Excludes all colliders not attached to a dynamic rigid-body.

Source

pub fn only_kinematic() -> Self

Excludes all colliders not attached to a kinematic rigid-body.

Source

pub fn only_fixed() -> Self

Exclude all colliders attached to a non-fixed rigid-body (this will not exclude colliders not attached to any rigid-body).

Source

pub fn exclude_sensors(self) -> Self

Exclude from the query any collider that is a sensor.

Source

pub fn exclude_solids(self) -> Self

Exclude from the query any collider that is not a sensor.

Source

pub fn groups(self, groups: CollisionGroups) -> Self

Only colliders with collision groups compatible with this one will be included in the scene query.

The CollisionGroups::test_mode of both groups is taken into account.

Source

pub fn exclude_collider(self, collider: Entity) -> Self

Set the collider that will be excluded from the scene query.

Source

pub fn exclude_rigid_body(self, rigid_body: Entity) -> Self

Set the rigid-body that will be excluded from the scene query.

Source

pub fn predicate( self, predicate: &'a impl Fn(Entity, &RapierCollider) -> bool, ) -> Self

Set the predicate to apply a custom collider filtering during the scene query.

The predicate is given the collider’s entity and its Rapier collider.

Trait Implementations§

Source§

impl<'a> Clone for QueryFilter<'a>

Source§

fn clone(&self) -> QueryFilter<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for QueryFilter<'a>

Source§

impl<'a> Default for QueryFilter<'a>

Source§

fn default() -> QueryFilter<'a>

Returns the “default value” for a type. Read more
Source§

impl From<CollisionGroups> for QueryFilter<'_>

Source§

fn from(groups: CollisionGroups) -> Self

Converts to this type from the input type.
Source§

impl From<QueryFilterFlags> for QueryFilter<'_>

Source§

fn from(flags: QueryFilterFlags) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for QueryFilter<'a>

§

impl<'a> !Send for QueryFilter<'a>

§

impl<'a> !Sync for QueryFilter<'a>

§

impl<'a> !UnwindSafe for QueryFilter<'a>

§

impl<'a> Freeze for QueryFilter<'a>

§

impl<'a> Unpin for QueryFilter<'a>

§

impl<'a> UnsafeUnpin for QueryFilter<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, U> AsBindGroupShaderType<U> for T
where U: ShaderType, &'a T: for<'a> Into<U>,

Source§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U

Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromTemplate for T
where T: Clone + Default + Unpin,

Source§

type Template = T

The Template for this type.
Source§

impl<T> FromWorld for T
where T: Default,

Source§

fn from_world(_world: &mut World) -> T

Creates Self using default().

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<A> Is for A
where A: Any,

Source§

fn is<T>() -> bool
where T: Any,

Checks if the current type “is” another type, using a TypeId equality comparison. This is most useful in the context of generic logic. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> Template for T
where T: Clone + Unpin,

Source§

type Output = T

The type of value produced by this Template.
Source§

fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>

Uses this template and the given entity context to produce a Template::Output.
Source§

fn clone_template(&self) -> T

Clones this template. See Clone.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more