128 lines
5.6 KiB
C++
128 lines
5.6 KiB
C++
|
/****************************************************************************************
|
||
|
* \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
|
||
|
|
||
|
// 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 */
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
|
||
|
/// <summary>
|
||
|
/// Casts an infinite ray into the world.
|
||
|
/// </summary>
|
||
|
/// <param name="ray">The ray to cast.</param>
|
||
|
/// <returns>The result of the raycast.</returns>
|
||
|
static RaycastHit Raycast (Ray ray);
|
||
|
|
||
|
/// <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>
|
||
|
/// <returns>The result of the raycast.</returns>
|
||
|
static RaycastHit Raycast (Ray ray, float distance);
|
||
|
|
||
|
/// <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>
|
||
|
/// <returns>The result of the raycast.</returns>
|
||
|
static RaycastHit Linecast (Vector3 start, Vector3 end);
|
||
|
|
||
|
/// <summary>
|
||
|
/// Casts an infinite ray w.r.t a GameObject.
|
||
|
/// </summary>
|
||
|
/// <param name="object">The GameObject to cast the ray to.</param>
|
||
|
/// <param name="ray">The ray to cast.</param>
|
||
|
/// <returns>The result of the raycast.</returns>
|
||
|
static RaycastHit ColliderRaycast (GameObject object, Ray ray);
|
||
|
|
||
|
/// <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>
|
||
|
/// <param name="ray">The ray to cast.</param>
|
||
|
/// <param name="distance">The distance to cast the ray.</param>
|
||
|
/// <returns>The result of the raycast.</returns>
|
||
|
static RaycastHit ColliderRaycast (GameObject object, Ray ray, float distance);
|
||
|
|
||
|
/// <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>
|
||
|
/// <param name="ray">The ray to cast.</param>
|
||
|
/// <returns>The result of the raycast.</returns>
|
||
|
static RaycastHit ColliderRaycast (GameObject object, int shapeIndex, Ray ray);
|
||
|
|
||
|
/// <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>
|
||
|
/// <param name="ray">The ray to cast.</param>
|
||
|
/// <param name="distance">The distance to cast the ray.</param>
|
||
|
/// <returns>The result of the raycast.</returns>
|
||
|
static RaycastHit ColliderRaycast (GameObject object, int shapeIndex, Ray ray, float distance);
|
||
|
|
||
|
/// <summary>
|
||
|
/// Casts a bounded ray w.r.t a GameObject.
|
||
|
/// </summary>
|
||
|
/// <param name="object">The GameObject to cast the ray to.</param>
|
||
|
/// <param name="start">The start of the bounded ray.</param>
|
||
|
/// <param name="end"></param>
|
||
|
/// <returns>The result of the raycast.</returns>
|
||
|
static RaycastHit ColliderLineCast (GameObject object, Vector3 start, Vector3 end);
|
||
|
|
||
|
/// <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>
|
||
|
/// <param name="start">The start of the bounded ray.</param>
|
||
|
/// <param name="end">The end of the bounded ray.</param>
|
||
|
/// <returns>The result of the raycast.</returns>
|
||
|
static RaycastHit ColliderLineCast (GameObject object, int shapeIndex, Vector3 start, Vector3 end);
|
||
|
|
||
|
private:
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
/* Function Members */
|
||
|
/*---------------------------------------------------------------------------------*/
|
||
|
|
||
|
static RaycastHit generateDefaultResult ();
|
||
|
};
|
||
|
|
||
|
} // namespace SHADE
|