Vixen
02b45cc4
csharp
public readonly record struct QueryFilter

Which bodies a query is allowed to see.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

IgnoreBody is here rather than left to the caller because the caller cannot do it: a "closest hit" query that returns the asker has thrown away the hit that was wanted, and filtering afterwards gives an empty result rather than the second-closest.

Sensors are excluded by default. A trigger volume is not geometry — a line of sight test that stops at the doorway's trigger is the bug, and the caller who does want them says so.

The two fields are stored inverted, and that is the whole design. Every query takes this as an optional parameter, so default has to mean "no filtering". Stored plainly, a default filter would carry an empty layer mask and body zero — a query that hits nothing and excludes a real body — and the failure would be silent. Holding the complement of the mask and the successor of the handle makes the all-zero value mean exactly "every layer, no exclusion", so Raycast(a, b, c, out var hit) does the obvious thing and QueryFilter.On(PhysicsLayerMask.None) still honestly means none.

Fields and properties (4)

  • public PhysicsLayerMask Layers

    The layers it considers.

  • public BodyHandle IgnoreBody

    One body to skip — almost always the one asking.

  • public bool IncludeSensors

    Whether trigger volumes count as hits.

  • public static QueryFilter Default

    Everything solid, on every layer. The same value as default.

Methods (3)

Used by (3)

  • PhysicsOcclusionProviderVixen.Audio.Physics
  • PhysicsQueryTestsVixen.Physics.Tests
  • PhysicsWorldVixen.Physics