24 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using Engine.Core;
 | 
						|
 | 
						|
namespace 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;
 | 
						|
}
 |