Skip to content

PhysicsQueryFilter Struct

Definition

Namespace: Brine2D.Physics

Filter for physics queries \(raycasts, shape casts, overlap tests\). Mirrors the layer/mask system used by PhysicsBodyComponent.

C#
public readonly struct PhysicsQueryFilter
Properties
CategoryMask Bitmask of categories that the querying shape belongs to. Only shapes whose CollisionMask includes this category will be reported. Default: all categories.
CollisionMask Bitmask of categories this query should hit. Default: all categories.
ExcludeBodies When non-null, all shapes belonging to any of these bodies are excluded from query results. Extends ExcludeBody for multi-body self-exclusion \(e\.g\. compound characters with multiple colliders, or ignore\-list queries\).
ExcludeBody When non-null, all shapes belonging to this body are excluded from query results. Useful for self-exclusion when casting from a body's own position. For excluding multiple bodies, use ExcludeBodies.
ExcludeSensors When true, sensor \(trigger\) shapes are excluded from query results. Filtering is applied post-callback via B2.ShapeIsSensor. Useful for ground-detection casts and line-of-sight tests that must not hit trigger zones. Default is false \(sensors are included\).
SolidOnly A pre-built filter that excludes sensor shapes and hits all solid layers. Suitable for ground-detection casts and line-of-sight tests.
Methods
ForLayer\(int\) Creates a filter that only hits shapes on the given layer \(0–63\).
ForLayers\(ReadOnlySpan<int>\) Creates a filter that hits shapes on any of the given layers \(0–63\).
SolidLayer\(int\) Creates a filter that only hits solid \(non\-sensor\) shapes on the given layer \(0–63\).
SolidLayers\(ReadOnlySpan<int>\) Creates a filter that only hits solid \(non\-sensor\) shapes on any of the given layers \(0–63\).