| | | 1 | | //======================================================================= |
| | | 2 | | // PhysicsSweepCircleAgainst3DRequest.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 2D swept-circle query against 3D colliders. |
| | | 16 | | /// </summary> |
| | | 17 | | public readonly struct PhysicsSweepCircleAgainst3DRequest |
| | | 18 | | { |
| | | 19 | | /// <summary> |
| | | 20 | | /// Creates a mixed 2D circle-slab sweep against 3D colliders. |
| | | 21 | | /// </summary> |
| | | 22 | | public PhysicsSweepCircleAgainst3DRequest( |
| | | 23 | | Vector2d start, |
| | | 24 | | Vector2d end, |
| | | 25 | | Fixed64 radius, |
| | | 26 | | Fixed64 slabCenterY, |
| | | 27 | | Fixed64 halfThickness, |
| | | 28 | | PhysicsLayerMask layerMask, |
| | | 29 | | LSCollider2D? excludedCollider = null, |
| | | 30 | | bool includeTriggers = true) |
| | | 31 | | { |
| | 11 | 32 | | Start = start; |
| | 11 | 33 | | End = end; |
| | 11 | 34 | | Radius = radius; |
| | 11 | 35 | | SlabCenterY = slabCenterY; |
| | 11 | 36 | | HalfThickness = halfThickness; |
| | 11 | 37 | | LayerMask = layerMask; |
| | 11 | 38 | | ExcludedCollider = excludedCollider; |
| | 11 | 39 | | IncludeTriggers = includeTriggers; |
| | 11 | 40 | | } |
| | | 41 | | |
| | | 42 | | /// <summary> |
| | | 43 | | /// Creates a mixed 2D circle-slab sweep against all 3D physics layers. |
| | | 44 | | /// </summary> |
| | | 45 | | public PhysicsSweepCircleAgainst3DRequest( |
| | | 46 | | Vector2d start, |
| | | 47 | | Vector2d end, |
| | | 48 | | Fixed64 radius, |
| | | 49 | | Fixed64 slabCenterY, |
| | | 50 | | Fixed64 halfThickness) |
| | 8 | 51 | | : this(start, end, radius, slabCenterY, halfThickness, PhysicsLayerMask.All) |
| | | 52 | | { |
| | 8 | 53 | | } |
| | | 54 | | |
| | | 55 | | /// <summary> |
| | | 56 | | /// Gets the circle center's start in the X/Z plane. |
| | | 57 | | /// </summary> |
| | | 58 | | public Vector2d Start { get; } |
| | | 59 | | |
| | | 60 | | /// <summary> |
| | | 61 | | /// Gets the circle center's end in the X/Z plane. |
| | | 62 | | /// </summary> |
| | | 63 | | public Vector2d End { get; } |
| | | 64 | | |
| | | 65 | | /// <summary> |
| | | 66 | | /// Gets the swept circle radius. |
| | | 67 | | /// </summary> |
| | | 68 | | public Fixed64 Radius { get; } |
| | | 69 | | |
| | | 70 | | /// <summary> |
| | | 71 | | /// Gets the world-space Y coordinate at the center of the embedded slab. |
| | | 72 | | /// </summary> |
| | | 73 | | public Fixed64 SlabCenterY { get; } |
| | | 74 | | |
| | | 75 | | /// <summary> |
| | | 76 | | /// Gets the slab half-thickness along the Y axis. |
| | | 77 | | /// </summary> |
| | | 78 | | public Fixed64 HalfThickness { get; } |
| | | 79 | | |
| | | 80 | | /// <summary> |
| | | 81 | | /// Gets the included 3D target layers. |
| | | 82 | | /// </summary> |
| | | 83 | | public PhysicsLayerMask LayerMask { get; } |
| | | 84 | | |
| | | 85 | | /// <summary> |
| | | 86 | | /// Gets the optional 2D source collider used for mixed-collision filtering. |
| | | 87 | | /// </summary> |
| | | 88 | | public LSCollider2D? ExcludedCollider { get; } |
| | | 89 | | |
| | | 90 | | /// <summary> |
| | | 91 | | /// Gets whether trigger targets are included. |
| | | 92 | | /// </summary> |
| | | 93 | | public bool IncludeTriggers { get; } |
| | | 94 | | } |