feat: added raycasting support for physics engine 2D
This commit is contained in:
23
Engine.Physics2D/Abstract/IRaycastResolver2D.cs
Normal file
23
Engine.Physics2D/Abstract/IRaycastResolver2D.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Syntriax.Engine.Core;
|
||||
|
||||
namespace Syntriax.Engine.Physics2D;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a 2D raycast resolver.
|
||||
/// </summary>
|
||||
public interface IRaycastResolver2D
|
||||
{
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Ray2D"/> against a specific <see cref="ICollider2D"/> shape and returns the first hit, if any.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the <see cref="ICollider2D"/>, which must implement <see cref="ICollider2D"/>.</typeparam>
|
||||
/// <param name="shape">The <see cref="ICollider2D"/> shape to test against.</param>
|
||||
/// <param name="ray">The <see cref="Ray2D"/> to cast.</param>
|
||||
/// <param name="length">
|
||||
/// The maximum distance to check along the <see cref="Ray2D"/>. Defaults to <see cref="float.MaxValue"/>.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A <see cref="RaycastResult"/> containing information about the intersection, or <see cref="null"/> if there was no hit.
|
||||
/// </returns>
|
||||
RaycastResult? RaycastAgainst<T>(T shape, Ray2D ray, float length = float.MaxValue) where T : ICollider2D;
|
||||
}
|
Reference in New Issue
Block a user