| | | 1 | | //======================================================================= |
| | | 2 | | // PhysicsSweepSphereAgainst2DRequest.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.Colliders; |
| | | 10 | | using Gravitas.Support; |
| | | 11 | | |
| | | 12 | | namespace Gravitas.Queries; |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// Describes one mixed 3D swept-sphere query against embedded 2D slabs. |
| | | 16 | | /// </summary> |
| | | 17 | | public readonly struct PhysicsSweepSphereAgainst2DRequest |
| | | 18 | | { |
| | | 19 | | /// <summary> |
| | | 20 | | /// Creates a mixed 3D sphere sweep against embedded 2D slabs. |
| | | 21 | | /// </summary> |
| | | 22 | | public PhysicsSweepSphereAgainst2DRequest( |
| | | 23 | | Vector3d start, |
| | | 24 | | Vector3d end, |
| | | 25 | | Fixed64 radius, |
| | | 26 | | PhysicsLayerMask layerMask, |
| | | 27 | | LSCollider? excludedCollider = null, |
| | | 28 | | bool includeTriggers = true) |
| | | 29 | | { |
| | 13 | 30 | | Start = start; |
| | 13 | 31 | | End = end; |
| | 13 | 32 | | Radius = radius; |
| | 13 | 33 | | LayerMask = layerMask; |
| | 13 | 34 | | ExcludedCollider = excludedCollider; |
| | 13 | 35 | | IncludeTriggers = includeTriggers; |
| | 13 | 36 | | } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Creates a mixed 3D sphere sweep against all embedded 2D physics layers. |
| | | 40 | | /// </summary> |
| | | 41 | | public PhysicsSweepSphereAgainst2DRequest(Vector3d start, Vector3d end, Fixed64 radius) |
| | 10 | 42 | | : this(start, end, radius, PhysicsLayerMask.All) |
| | | 43 | | { |
| | 10 | 44 | | } |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Gets the sphere center's world-space start. |
| | | 48 | | /// </summary> |
| | | 49 | | public Vector3d Start { get; } |
| | | 50 | | |
| | | 51 | | /// <summary> |
| | | 52 | | /// Gets the sphere center's world-space end. |
| | | 53 | | /// </summary> |
| | | 54 | | public Vector3d End { get; } |
| | | 55 | | |
| | | 56 | | /// <summary> |
| | | 57 | | /// Gets the swept sphere radius. |
| | | 58 | | /// </summary> |
| | | 59 | | public Fixed64 Radius { get; } |
| | | 60 | | |
| | | 61 | | /// <summary> |
| | | 62 | | /// Gets the included 2D target layers. |
| | | 63 | | /// </summary> |
| | | 64 | | public PhysicsLayerMask LayerMask { get; } |
| | | 65 | | |
| | | 66 | | /// <summary> |
| | | 67 | | /// Gets the optional 3D source collider used for mixed-collision filtering. |
| | | 68 | | /// </summary> |
| | | 69 | | public LSCollider? ExcludedCollider { get; } |
| | | 70 | | |
| | | 71 | | /// <summary> |
| | | 72 | | /// Gets whether trigger targets are included. |
| | | 73 | | /// </summary> |
| | | 74 | | public bool IncludeTriggers { get; } |
| | | 75 | | } |