Table of Contents

Struct QueryFilter

Namespace
Box3D
Assembly
Box3D.NET.dll

Restricts which shapes a query such as a ray cast is allowed to hit.

public readonly record struct QueryFilter : IEquatable<QueryFilter>

Implements

Inherited Members

Examples

A bullet that hits the world and enemies but passes through debris:

var filter = new QueryFilter
{
    Categories  = (ulong)Layers.Bullet,
    CollidesWith = (ulong)(Layers.World | Layers.Enemy),
};

if (world.RaycastClosest(muzzle, direction * range, filter) is { Hit: true } hit)
{
    ApplyDamage(hit.Shape, hit.Point);
}

Remarks

The same category and mask rules as Box3D.CollisionFilter apply, with the query standing in for one of the two shapes.

Constructors

QueryFilter(ulong, ulong)

Initializes a new instance of the Box3D.QueryFilter struct.

Properties

Categories

Gets the categories this query belongs to. Usually a single bit.

CollidesWith

Gets the shape categories this query can hit.

Default

Gets a filter that can hit everything.