2022-11-19 04:21:46 +08:00
|
|
|
/****************************************************************************************
|
|
|
|
* \file Physics.hxx
|
|
|
|
* \author Diren D Bharwani, diren.dbharwani, 390002520
|
|
|
|
* \brief Interface for the managed Physics class.
|
|
|
|
*
|
|
|
|
* \copyright Copyright (C) 2022 DigiPen Institute of Technology. Reproduction or
|
|
|
|
* disclosure of this file or its contents without the prior written consent
|
|
|
|
* of DigiPen Institute of Technology is prohibited.
|
|
|
|
****************************************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-01-02 22:31:48 +08:00
|
|
|
|
2022-11-19 04:21:46 +08:00
|
|
|
// Project Includes
|
|
|
|
#include "Math/Ray.hxx"
|
|
|
|
#include "RaycastHit.hxx"
|
|
|
|
|
|
|
|
namespace SHADE
|
|
|
|
{
|
|
|
|
/*-----------------------------------------------------------------------------------*/
|
|
|
|
/* Type Definitions */
|
|
|
|
/*-----------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
public ref class Physics abstract sealed
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
/* Properties */
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
static property Vector3 Gravity
|
|
|
|
{
|
|
|
|
Vector3 get();
|
|
|
|
void set(Vector3 value);
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(Diren): Add more properties for physics system settings.
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
/* Raycast Function Members */
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
|
2023-01-02 22:31:48 +08:00
|
|
|
// TODO(Diren): Add layers for raycasting
|
|
|
|
|
2022-11-19 04:21:46 +08:00
|
|
|
/// <summary>
|
2023-01-02 22:31:48 +08:00
|
|
|
/// Casts an infinite ray into the world. <br/>
|
|
|
|
/// This raycast will stop at the first object hit.
|
2022-11-19 04:21:46 +08:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="ray">The ray to cast.</param>
|
2023-01-02 22:31:48 +08:00
|
|
|
/// <param name="continuous">
|
|
|
|
/// Whether or not the raycast should stop at the first object hit.
|
|
|
|
/// </param>
|
|
|
|
/// <returns>
|
|
|
|
/// The results of the raycast. If nothing was hit, an empty list is returned.
|
|
|
|
/// </returns>
|
|
|
|
static System::Collections::Generic::List<RaycastHit>^ Raycast (Ray ray, bool continuous);
|
2022-11-19 04:21:46 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Casts a ray for a given distance into the world.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="ray">The ray to cast.</param>
|
|
|
|
/// <param name="distance">The distance to cast the ray.</param>
|
2023-01-02 22:31:48 +08:00
|
|
|
/// <param name="continuous">
|
|
|
|
/// Whether or not the raycast should stop at the first object hit.
|
|
|
|
/// </param>
|
|
|
|
/// <returns>
|
|
|
|
/// The results of the raycast. If nothing was hit, an empty list is returned.
|
|
|
|
/// </returns>
|
|
|
|
static System::Collections::Generic::List<RaycastHit>^ Raycast (Ray ray, float distance, bool continuous);
|
2022-11-19 04:21:46 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Casts a bounded ray into the world.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="start">The start of the bounded ray.</param>
|
|
|
|
/// <param name="end">The end of the bounded ray.</param>
|
2023-01-02 22:31:48 +08:00
|
|
|
/// <param name="continuous">
|
|
|
|
/// Whether or not the raycast should stop at the first object hit.
|
|
|
|
/// </param>
|
|
|
|
/// <returns>
|
|
|
|
/// The results of the raycast. If nothing was hit, an empty list is returned.
|
|
|
|
/// </returns>
|
|
|
|
static System::Collections::Generic::List<RaycastHit>^ Linecast (Vector3 start, Vector3 end, bool continuous);
|
2022-11-19 04:21:46 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Casts an infinite ray w.r.t a GameObject.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="object">The GameObject to cast the ray to.</param>
|
2023-01-02 22:31:48 +08:00
|
|
|
/// <param name="ray">
|
|
|
|
/// The ray to cast. <br/>
|
|
|
|
/// The position of the ray is offset from the collider's position.
|
|
|
|
/// </param>
|
|
|
|
/// <param name="continuous">
|
|
|
|
/// Whether or not the raycast should stop at the first object hit.
|
|
|
|
/// </param>
|
|
|
|
/// <returns>
|
|
|
|
/// The results of the raycast. If nothing was hit, an empty list is returned.
|
|
|
|
/// </returns>
|
|
|
|
static System::Collections::Generic::List<RaycastHit>^ ColliderRaycast (GameObject object, Ray ray, bool continuous);
|
2022-11-19 04:21:46 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Casts a ray for a given distance w.r.t a GameObject.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="object">The GameObject to cast the ray to.</param>
|
2023-01-02 22:31:48 +08:00
|
|
|
/// <param name="ray">
|
|
|
|
/// The ray to cast. <br/>
|
|
|
|
/// The position of the ray is offset from the collider's position.
|
|
|
|
/// </param>
|
2022-11-19 04:21:46 +08:00
|
|
|
/// <param name="distance">The distance to cast the ray.</param>
|
2023-01-02 22:31:48 +08:00
|
|
|
/// <param name="continuous">
|
|
|
|
/// Whether or not the raycast should stop at the first object hit.
|
|
|
|
/// </param>
|
|
|
|
/// <returns>
|
|
|
|
/// The results of the raycast. If nothing was hit, an empty list is returned.
|
|
|
|
/// </returns>
|
|
|
|
static System::Collections::Generic::List<RaycastHit>^ ColliderRaycast (GameObject object, Ray ray, float distance, bool continuous);
|
2022-11-19 04:21:46 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Casts an infinite ray w.r.t a specific collider on a GameObject.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="object">The GameObject to cast the ray to.</param>
|
|
|
|
/// <param name="shapeIndex">The collision shape index on the collider to cast to.</param>
|
2023-01-02 22:31:48 +08:00
|
|
|
/// <param name="ray">
|
|
|
|
/// The ray to cast. <br/>
|
|
|
|
/// The position of the ray is offset from the collider's position.
|
|
|
|
/// </param>
|
|
|
|
/// <param name="continuous">
|
|
|
|
/// Whether or not the raycast should stop at the first object hit.
|
|
|
|
/// </param>
|
|
|
|
/// <returns>
|
|
|
|
/// The results of the raycast. If nothing was hit, an empty list is returned.
|
|
|
|
/// </returns>
|
|
|
|
static System::Collections::Generic::List<RaycastHit>^ ColliderRaycast (GameObject object, int shapeIndex, Ray ray, bool continuous);
|
2022-11-19 04:21:46 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Casts a ray for a given distance w.r.t a specific collider on a GameObject.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="object">The GameObject to cast the ray to.</param>
|
|
|
|
/// <param name="shapeIndex">The collision shape index on the collider to cast to.</param>
|
2023-01-02 22:31:48 +08:00
|
|
|
/// <param name="ray">
|
|
|
|
/// The ray to cast. <br/>
|
|
|
|
/// The position of the ray is offset from the collider's position.
|
|
|
|
/// </param>
|
2022-11-19 04:21:46 +08:00
|
|
|
/// <param name="distance">The distance to cast the ray.</param>
|
2023-01-02 22:31:48 +08:00
|
|
|
/// <param name="continuous">
|
|
|
|
/// Whether or not the raycast should stop at the first object hit.
|
|
|
|
/// </param>
|
|
|
|
/// <returns>
|
|
|
|
/// The results of the raycast. If nothing was hit, an empty list is returned.
|
|
|
|
/// </returns>
|
|
|
|
static System::Collections::Generic::List<RaycastHit>^ ColliderRaycast (GameObject object, int shapeIndex, Ray ray, float distance, bool continuous);
|
2022-11-19 04:21:46 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Casts a bounded ray w.r.t a GameObject.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="object">The GameObject to cast the ray to.</param>
|
2023-01-02 22:31:48 +08:00
|
|
|
/// <param name="start">
|
|
|
|
/// The start of the bounded ray. <br/>
|
|
|
|
/// The start of the ray is offset from the collider's position. </param>
|
2022-11-19 04:21:46 +08:00
|
|
|
/// <param name="end"></param>
|
2023-01-02 22:31:48 +08:00
|
|
|
/// <param name="continuous">
|
|
|
|
/// Whether or not the raycast should stop at the first object hit.
|
|
|
|
/// </param>
|
|
|
|
/// <returns>
|
|
|
|
/// The results of the raycast. If nothing was hit, an empty list is returned.
|
|
|
|
/// </returns>
|
|
|
|
static System::Collections::Generic::List<RaycastHit>^ ColliderLineCast (GameObject object, Vector3 start, Vector3 end, bool continuous);
|
2022-11-19 04:21:46 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Casts a bounded ray w.r.t a specific collider on a GameObject.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="object">The GameObject to cast the ray to.</param>
|
|
|
|
/// <param name="shapeIndex">The collision shape index on the collider to cast to.</param>
|
2023-01-02 22:31:48 +08:00
|
|
|
/// <param name="start">
|
|
|
|
/// The start of the bounded ray. <br/>
|
|
|
|
/// The start of the ray is offset from the collider's position. </param>
|
2022-11-19 04:21:46 +08:00
|
|
|
/// <param name="end">The end of the bounded ray.</param>
|
2023-01-02 22:31:48 +08:00
|
|
|
/// <param name="continuous">
|
|
|
|
/// Whether or not the raycast should stop at the first object hit.
|
|
|
|
/// </param>
|
|
|
|
/// <returns>
|
|
|
|
/// The results of the raycast. If nothing was hit, an empty list is returned./// </returns>
|
|
|
|
static System::Collections::Generic::List<RaycastHit>^ ColliderLineCast (GameObject object, int shapeIndex, Vector3 start, Vector3 end, bool continuous);
|
2022-11-19 04:21:46 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
/* Function Members */
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
static RaycastHit generateDefaultResult ();
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace SHADE
|