Skip to content

PhysicsAPI reference

Struct QueryFilter

Namespace: MicroEngine.Physics
Assembly: MicroEngine.Physics.dll
Guide: Physics worlds

Which shapes a query (RayCast, Overlap) or a Move considers. A shape matches when its category is in the filter’s Mask and the filter’s Category is in the shape’s mask. default is Default: category Default, every layer, sensors left out.

C#
public readonly struct QueryFilter : IEquatable<QueryFilter>

Implements

IEquatable<QueryFilter>

Constructors

QueryFilter(ulong, ulong)

A filter in category that sees mask.

C#
public QueryFilter(ulong category, ulong mask)

Parameters

category ulong

mask ulong

Properties

Category

The layers the query is in (shapes whose mask lacks them ignore it).

C#
public ulong Category { get; init; }

Property Value

ulong

Default

The default filter: category Default, every layer, no sensors.

C#
public static QueryFilter Default { get; }

Property Value

QueryFilter

IncludeSensors

Whether ray casts and overlaps return sensor shapes (false by default). Sensors never block Move, whatever this says.

C#
public bool IncludeSensors { get; init; }

Property Value

bool

Mask

The layers the query sees.

C#
public ulong Mask { get; init; }

Property Value

ulong

PassOneWay

Whether one-way platforms are passed through (dropping down through a platform); false by default.

C#
public bool PassOneWay { get; init; }

Property Value

bool

Methods

Accepts(ulong, ulong)

Whether a shape in category colliding with mask matches the filter’s layers.

C#
public bool Accepts(ulong category, ulong mask)

Parameters

category ulong

mask ulong

Returns

bool

Equals(object)

C#
public override bool Equals(object obj)

Parameters

obj object

Returns

bool

Equals(QueryFilter)

C#
public bool Equals(QueryFilter other)

Parameters

other QueryFilter

Returns

bool

For(in ShapeDescription)

The filter that moves or queries as shape would collide: its category and mask.

C#
public static QueryFilter For(in ShapeDescription shape)

Parameters

shape ShapeDescription

Returns

QueryFilter

GetHashCode()

C#
public override int GetHashCode()

Returns

int

ToString()

C#
public override string ToString()

Returns

string

Operators

operator ==(QueryFilter, QueryFilter)

C#
public static bool operator ==(QueryFilter left, QueryFilter right)

Parameters

left QueryFilter

right QueryFilter

Returns

bool

operator !=(QueryFilter, QueryFilter)

C#
public static bool operator !=(QueryFilter left, QueryFilter right)

Parameters

left QueryFilter

right QueryFilter

Returns

bool