PhysicsMask
A 64-bit mask, effectively 64 flags. The default enumerator will iterate all the bits that are set (1).
Read time 2 minutesLast updated 10 days ago
Definition
- Type: Struct
- Namespace: UnityEngine.LowLevelPhysics2D
- Assembly: UnityEngine.Physics2DModule
- Implements: IEnumerable<int>, IEnumerable
public struct PhysicsMask : IEnumerable<int>, IEnumerable
Fields
Value | Description |
|---|---|
| bitMask | A 64-bit mask, effectively 64 flags. |
Static Fields
Value | Description |
|---|---|
| All | All 64 bits set (1) in the PhysicsMask. |
| None | No bits set in the PhysicsMask, effectively zero. |
| One | Bit #0 set (1) in the PhysicsMask. The remaining bits are reset (0). |
Constructors
Constructor | Description |
|---|---|
| PhysicsMask(System.Int32[]) | Create a PhysicsMask by specifying multiple bits to set (1). |
| PhysicsMask(UnityEngine.LayerMask) | Create a PhysicsMask from a LayerMask. A LayerMask is only 32-bits wide so the PhysicsMask will have the upper 32-bits set to zero. |
Properties
Property | Description |
|---|---|
| resetBits | Gets an enumerable group of bits that are currently reset (0). The bits are returned in ascending bit-index order. This uses PhysicsMask.ResetBitIterator. |
| setBits | Gets an enumerable group of bits that are currently set (1). The bits are returned in ascending bit-index order. This uses PhysicsMask.SetBitIterator. |
Methods
Method | Description |
|---|---|
| AreAnyBitsSet | Checks if any of the provided PhysicsMask set bits are also set in this PhysicsMask. |
| AreBitsSet | Checks if all the provided PhysicsMask set bits are also set in this PhysicsMask. |
| IsBitSet | Is the specified bit set. |
| ResetBit | Reset (0) the specified bit. |
| SetBit | Set (1) the specified bit. |
| ToLayerMask | Convert the lower 32-bits of the 64-bit mask to the 32-bit LayerMask. A LayerMask is only 32-bits wide so the upper 32-bits of the PhysicsMask will be ignored. |
Classes
Class | Description |
|---|---|
| PhysicsMask.ShowAsPhysicsMaskAttribute | When applied to a field/property of type PhysicsMask, the field/property drawer will not be display it as PhysicsLayers. Instead, the field/property will be displayed as bit numbers only i.e. a raw 64-bit mask allowing each bit to be (de)selected. This is only used when full layer editing is active (see PhysicsLowLevelSettings2D.useFullLayers). |
Structs
Struct | Description |
|---|---|
| PhysicsMask.ResetBitIterator | An iterator that will iterate only the bits that are reset (0) in a PhysicsMask |
| PhysicsMask.SetBitIterator | An iterator that will iterate only the bits that are set (1) in a PhysicsMask |