PhysicsWorld.RaycastAllShapes Method
Definition¶
Namespace: Brine2D.Physics
| Overloads | |
|---|---|
| RaycastAllShapes(Vector2, Vector2, float, List<RaycastHit>, Nullable<PhysicsQueryFilter>) | Casts a ray and returns all shape hits (not deduplicated, sorted nearest-first) into results. Unlike the System.Span<> overloads, this variant retries with a larger internal buffer if needed and is guaranteed to return every hit. Clears results before writing. |
| RaycastAllShapes(Vector2, Vector2, float, Span<RaycastHit>, bool, Nullable<PhysicsQueryFilter>) | Casts a ray and returns all shape hits sorted by distance, without deduplicating by body. Compound bodies with multiple shapes can appear more than once in the results. Use this when you need to know exactly which shape on a body was hit. |
| RaycastAllShapes(Vector2, Vector2, float, Span<RaycastHit>, Nullable<PhysicsQueryFilter>) | Casts a ray and returns all shape hits sorted by distance, without deduplicating by body. Compound bodies with multiple shapes can appear more than once in the results. Use this when you need to know exactly which shape on a body was hit. |
PhysicsWorld.RaycastAllShapes(Vector2, Vector2, float, List\<RaycastHit>, Nullable\<PhysicsQueryFilter>) Method¶
Casts a ray and returns all shape hits (not deduplicated, sorted nearest-first) into results. Unlike the System.Span<> overloads, this variant retries with a larger internal buffer if needed and is guaranteed to return every hit. Clears results before writing.
public void RaycastAllShapes(System.Numerics.Vector2 origin, System.Numerics.Vector2 direction, float maxDistance, System.Collections.Generic.List<Brine2D.Physics.RaycastHit> results, System.Nullable<Brine2D.Physics.PhysicsQueryFilter> filter=null);
Parameters¶
origin System.Numerics.Vector2
direction System.Numerics.Vector2
maxDistance System.Single
results System.Collections.Generic.List<RaycastHit>
filter System.Nullable<PhysicsQueryFilter>
PhysicsWorld.RaycastAllShapes(Vector2, Vector2, float, Span\<RaycastHit>, bool, Nullable\<PhysicsQueryFilter>) Method¶
Casts a ray and returns all shape hits sorted by distance, without deduplicating by body. Compound bodies with multiple shapes can appear more than once in the results. Use this when you need to know exactly which shape on a body was hit.
public int RaycastAllShapes(System.Numerics.Vector2 origin, System.Numerics.Vector2 direction, float maxDistance, System.Span<Brine2D.Physics.RaycastHit> results, out bool wasTruncated, System.Nullable<Brine2D.Physics.PhysicsQueryFilter> filter=null);
Parameters¶
origin System.Numerics.Vector2
Ray start in pixel coordinates.
direction System.Numerics.Vector2
Ray direction (does not need to be normalized). Must be non-zero.
maxDistance System.Single
Maximum ray length in pixels.
results System.Span<RaycastHit>
Buffer to receive hits, sorted nearest-first.
wasTruncated System.Boolean
Set to true when the results buffer was too small to hold all hits.
filter System.Nullable<PhysicsQueryFilter>
Optional query filter.
Returns¶
System.Int32
Number of hits written to results.
Exceptions¶
System.ArgumentException
Thrown when direction is zero.
PhysicsWorld.RaycastAllShapes(Vector2, Vector2, float, Span\<RaycastHit>, Nullable\<PhysicsQueryFilter>) Method¶
Casts a ray and returns all shape hits sorted by distance, without deduplicating by body. Compound bodies with multiple shapes can appear more than once in the results. Use this when you need to know exactly which shape on a body was hit.
public int RaycastAllShapes(System.Numerics.Vector2 origin, System.Numerics.Vector2 direction, float maxDistance, System.Span<Brine2D.Physics.RaycastHit> results, System.Nullable<Brine2D.Physics.PhysicsQueryFilter> filter=null);
Parameters¶
origin System.Numerics.Vector2
Ray start in pixel coordinates.
direction System.Numerics.Vector2
Ray direction (does not need to be normalized). Must be non-zero.
maxDistance System.Single
Maximum ray length in pixels.
results System.Span<RaycastHit>
Buffer to receive hits, sorted nearest-first.
filter System.Nullable<PhysicsQueryFilter>
Optional query filter.
Returns¶
System.Int32
Number of hits written to results.
Exceptions¶
System.ArgumentException
Thrown when direction is zero.