// ------------------------------------------------------------------------ // Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved. // See LICENSE file in the project root for license information. // ------------------------------------------------------------------------ namespace Engine.Services { using Core.Abstraction; using UnityEngine; /// /// Interface for managing physics in the game. /// public interface IPhysicsManager { public int MaxRaycastHitCount { get; } /// /// Attempts to perform a raycast from a screen point in the camera's view. /// /// The screen point to cast the ray from. /// The resulting hit point and collider game entity, if any. /// The maximum distance to cast the ray. /// True if the raycast hit a collider, false otherwise. public bool TryCameraRaycastFromScreenPoint(Vector2 screenPoint, out (Vector3 hitPoint, IGameEntity colliderGameEntity) hitResult, float maxDistance = float.PositiveInfinity); /// /// Casts a ray from a screen point into the scene and returns information about any colliders hit. /// /// The screen point to cast the ray from. /// An array of hit results, each containing information about the hit point and the game entity of the collider. /// The maximum distance to cast the ray. /// The number of colliders hit. public int CameraRaycastFromScreenPoint(Vector2 screenPoint, (Vector3 hitPoint, IGameEntity colliderGameEntity)[] hitResults, float maxDistance = float.PositiveInfinity); /// /// Casts a box along a ray and returns all hits in the path. /// /// The center of the box. /// Half the size of the box in each dimension. /// The direction in which to cast the box. /// The orientation of the box. /// An array of hit results, each containing the hit point and the game entity of the collider. /// The number of hits found. public int BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, Quaternion orientation, (Vector3 hitPoint, IGameEntity colliderGameEntity)[] hitResults); } }