| | | 1 | | //======================================================================= |
| | | 2 | | // PhysicsOverlapPolygon2DRequest.cs |
| | | 3 | | //======================================================================= |
| | | 4 | | // MIT License, Copyright (c) 2026-present David Oravsky (mrdav30) |
| | | 5 | | // See LICENSE file in the project root for full license information. |
| | | 6 | | //======================================================================= |
| | | 7 | | |
| | | 8 | | using Gravitas.Support; |
| | | 9 | | |
| | | 10 | | namespace Gravitas.Queries; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Describes one pure 2D convex polygon overlap by referencing a flat vertex buffer. |
| | | 14 | | /// </summary> |
| | | 15 | | public readonly struct PhysicsOverlapPolygon2DRequest |
| | | 16 | | { |
| | | 17 | | /// <summary> |
| | | 18 | | /// Creates a pure 2D convex-polygon overlap request with an include layer mask. |
| | | 19 | | /// </summary> |
| | | 20 | | public PhysicsOverlapPolygon2DRequest(int vertexStart, int vertexCount, PhysicsLayerMask layerMask) |
| | | 21 | | { |
| | 7 | 22 | | VertexStart = vertexStart; |
| | 7 | 23 | | VertexCount = vertexCount; |
| | 7 | 24 | | LayerMask = layerMask; |
| | 7 | 25 | | } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// Creates a pure 2D convex-polygon overlap request against all physics layers. |
| | | 29 | | /// </summary> |
| | | 30 | | public PhysicsOverlapPolygon2DRequest(int vertexStart, int vertexCount) |
| | 1 | 31 | | : this(vertexStart, vertexCount, PhysicsLayerMask.All) |
| | | 32 | | { |
| | 1 | 33 | | } |
| | | 34 | | |
| | | 35 | | /// <summary> |
| | | 36 | | /// Gets the first polygon vertex index in the batch's shared vertex buffer. |
| | | 37 | | /// </summary> |
| | | 38 | | public int VertexStart { get; } |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// Gets the number of polygon vertices in the shared vertex buffer. |
| | | 42 | | /// </summary> |
| | | 43 | | public int VertexCount { get; } |
| | | 44 | | |
| | | 45 | | /// <summary> |
| | | 46 | | /// Gets the included physics layers. |
| | | 47 | | /// </summary> |
| | | 48 | | public PhysicsLayerMask LayerMask { get; } |
| | | 49 | | } |