| | | 1 | | //======================================================================= |
| | | 2 | | // PhysicsRaycast2DRequest.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 FixedMathSharp; |
| | | 9 | | using Gravitas.Support; |
| | | 10 | | |
| | | 11 | | namespace Gravitas.Queries; |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// Describes one pure 2D segment raycast in a batched query call. |
| | | 15 | | /// </summary> |
| | | 16 | | public readonly struct PhysicsRaycast2DRequest |
| | | 17 | | { |
| | | 18 | | /// <summary> |
| | | 19 | | /// Creates a pure 2D segment raycast request with an include layer mask. |
| | | 20 | | /// </summary> |
| | | 21 | | public PhysicsRaycast2DRequest(Vector2d start, Vector2d end, PhysicsLayerMask layerMask) |
| | | 22 | | { |
| | 13 | 23 | | Start = start; |
| | 13 | 24 | | End = end; |
| | 13 | 25 | | LayerMask = layerMask; |
| | 13 | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Creates a pure 2D segment raycast request against all physics layers. |
| | | 30 | | /// </summary> |
| | | 31 | | public PhysicsRaycast2DRequest(Vector2d start, Vector2d end) |
| | 8 | 32 | | : this(start, end, PhysicsLayerMask.All) |
| | | 33 | | { |
| | 8 | 34 | | } |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// Gets the segment start in the X/Z plane. |
| | | 38 | | /// </summary> |
| | | 39 | | public Vector2d Start { get; } |
| | | 40 | | |
| | | 41 | | /// <summary> |
| | | 42 | | /// Gets the segment end in the X/Z plane. |
| | | 43 | | /// </summary> |
| | | 44 | | public Vector2d End { get; } |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Gets the included physics layers. |
| | | 48 | | /// </summary> |
| | | 49 | | public PhysicsLayerMask LayerMask { get; } |
| | | 50 | | } |