CollisionLayers#
The project's collision layers and which pairs collide (every pair does unless the project says otherwise). A body sits in one layer; two 3D bodies collide only if their layers collide. Queries take a mask of layers to see.
public sealed record CollisionLayersMembers: BitOf · Collide · CollidesWith · CollisionLayers · Default · Find · Layers · Mask · MaskCollidingWith · MaxLayers · TryFind
BitOf#
public int BitOf(string idOrName);Bit of a layer by ID or name.
Collide#
public bool Collide(int a, int b);CollidesWith#
public uint CollidesWith(int bit);The layers a layer collides with, as a bit mask.
CollisionLayers#
public CollisionLayers(IReadOnlyList<CollisionLayerInfo> layers, IEnumerable<(int A, int B)> separate);| Parameter | Description |
|---|---|
layers | Distinct bits 0–31 and unique names; at least one layer, and one holds bit 0 (the default for bodies with none). |
separate | Pairs of bits that do NOT collide (either order; a pair may be a layer with itself). |
Default#
public static CollisionLayers Default { get; }Initial value: new(new[] { new CollisionLayerInfo("default", "Default", 0) }, Array.Empty<(int, int)>())
A project with no layer data: one layer, "Default", colliding with itself.
Find#
public CollisionLayerInfo Find(string idOrName);Layers#
public IReadOnlyList<CollisionLayerInfo> Layers { get; }Mask#
public int Mask(params string[] layers);A query mask seeing exactly these layers (by name or ID).
MaskCollidingWith#
public int MaskCollidingWith(string layer);A query mask seeing everything that collides with a layer (a bullet's view of the world).
MaxLayers#
public const int MaxLayers = 32;TryFind#
public bool TryFind(string idOrName, out CollisionLayerInfo layer);Related types#
Source#
- CollisionLayers.cs