| | | 1 | | //======================================================================= |
| | | 2 | | // PhysicsSweepSphere3DRequest.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 3D swept-sphere query in a batched query call. |
| | | 16 | | /// </summary> |
| | | 17 | | public readonly struct PhysicsSweepSphere3DRequest |
| | | 18 | | { |
| | | 19 | | /// <summary> |
| | | 20 | | /// Creates a 3D swept-sphere request. |
| | | 21 | | /// </summary> |
| | | 22 | | public PhysicsSweepSphere3DRequest( |
| | | 23 | | Vector3d start, |
| | | 24 | | Vector3d end, |
| | | 25 | | Fixed64 radius, |
| | | 26 | | PhysicsLayerMask layerMask, |
| | | 27 | | LSCollider? excludedCollider = null) |
| | | 28 | | { |
| | 14 | 29 | | Start = start; |
| | 14 | 30 | | End = end; |
| | 14 | 31 | | Radius = radius; |
| | 14 | 32 | | LayerMask = layerMask; |
| | 14 | 33 | | ExcludedCollider = excludedCollider; |
| | 14 | 34 | | } |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// Creates a 3D swept-sphere request against all physics layers. |
| | | 38 | | /// </summary> |
| | | 39 | | public PhysicsSweepSphere3DRequest(Vector3d start, Vector3d end, Fixed64 radius) |
| | 5 | 40 | | : this(start, end, radius, PhysicsLayerMask.All) |
| | | 41 | | { |
| | 5 | 42 | | } |
| | | 43 | | |
| | | 44 | | /// <summary> |
| | | 45 | | /// Gets the sphere center's world-space start. |
| | | 46 | | /// </summary> |
| | | 47 | | public Vector3d Start { get; } |
| | | 48 | | |
| | | 49 | | /// <summary> |
| | | 50 | | /// Gets the sphere center's world-space end. |
| | | 51 | | /// </summary> |
| | | 52 | | public Vector3d End { get; } |
| | | 53 | | |
| | | 54 | | /// <summary> |
| | | 55 | | /// Gets the swept sphere radius. |
| | | 56 | | /// </summary> |
| | | 57 | | public Fixed64 Radius { get; } |
| | | 58 | | |
| | | 59 | | /// <summary> |
| | | 60 | | /// Gets the included physics layers. |
| | | 61 | | /// </summary> |
| | | 62 | | public PhysicsLayerMask LayerMask { get; } |
| | | 63 | | |
| | | 64 | | /// <summary> |
| | | 65 | | /// Gets the collider omitted from candidate results, if any. |
| | | 66 | | /// </summary> |
| | | 67 | | public LSCollider? ExcludedCollider { get; } |
| | | 68 | | } |