BsScriptPhysics.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsScriptEnginePrerequisites.h"
  5. #include "BsScriptObject.h"
  6. #include "BsScriptPhysicsQueryHit.h"
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup ScriptInteropEngine
  10. * @{
  11. */
  12. /** Interop class between C++ & CLR for Physics. */
  13. class BS_SCR_BE_EXPORT ScriptPhysics : public ScriptObject<ScriptPhysics>
  14. {
  15. public:
  16. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Physics")
  17. private:
  18. ScriptPhysics(MonoObject* instance);
  19. /************************************************************************/
  20. /* CLR HOOKS */
  21. /************************************************************************/
  22. static void internal_GetGravity(Vector3* gravity);
  23. static void internal_SetGravity(Vector3* gravity);
  24. static int internal_AddPhysicsRegion(AABox* region);
  25. static void internal_RemovePhysicsRegion(int handle);
  26. static void internal_ClearPhysicsRegions();
  27. static void internal_ToggleCollision(UINT64 layerA, UINT64 layerB, bool enabled);
  28. static bool internal_IsCollisionEnabled(UINT64 layerA, UINT64 layerB);
  29. static bool internal_IsUpdateInProgress();
  30. static bool internal_RayCast(Vector3* origin, Vector3* unitDir, ScriptPhysicsQueryHit* hit, UINT64 layer, float max);
  31. static bool internal_BoxCast(AABox* box, Quaternion* rotation, Vector3* unitDir, ScriptPhysicsQueryHit* hit, UINT64 layer, float max);
  32. static bool internal_SphereCast(Sphere* sphere, Vector3* unitDir, ScriptPhysicsQueryHit* hit, UINT64 layer, float max);
  33. static bool internal_CapsuleCast(Capsule* capsule, Quaternion* rotation, Vector3* unitDir, ScriptPhysicsQueryHit* hit, UINT64 layer, float max);
  34. static bool internal_ConvexCast(ScriptPhysicsMesh* mesh, Vector3* position, Quaternion* rotation, Vector3* unitDir, ScriptPhysicsQueryHit* hit, UINT64 layer, float max);
  35. static MonoArray* internal_RayCastAll(Vector3* origin, Vector3* unitDir, UINT64 layer, float max);
  36. static MonoArray* internal_BoxCastAll(AABox* box, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
  37. static MonoArray* internal_SphereCastAll(Sphere* sphere, Vector3* unitDir, UINT64 layer, float max);
  38. static MonoArray* internal_CapsuleCastAll(Capsule* capsule, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
  39. static MonoArray* internal_ConvexCastAll(ScriptPhysicsMesh* mesh, Vector3* position, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
  40. static bool internal_RayCastAny(Vector3* origin, Vector3* unitDir, UINT64 layer, float max);
  41. static bool internal_BoxCastAny(AABox* box, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
  42. static bool internal_SphereCastAny(Sphere* sphere, Vector3* unitDir, UINT64 layer, float max);
  43. static bool internal_CapsuleCastAny(Capsule* capsule, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
  44. static bool internal_ConvexCastAny(ScriptPhysicsMesh* mesh, Vector3* position, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
  45. static MonoArray* internal_BoxOverlap(AABox* box, Quaternion* rotation, UINT64 layer);
  46. static MonoArray* internal_SphereOverlap(Sphere* sphere, UINT64 layer);
  47. static MonoArray* internal_CapsuleOverlap(Capsule* capsule, Quaternion* rotation, UINT64 layer);
  48. static MonoArray* internal_ConvexOverlap(ScriptPhysicsMesh* mesh, Vector3* position, Quaternion* rotation, UINT64 layer);
  49. static bool internal_BoxOverlapAny(AABox* box, Quaternion* rotation, UINT64 layer);
  50. static bool internal_SphereOverlapAny(Sphere* sphere, UINT64 layer);
  51. static bool internal_CapsuleOverlapAny(Capsule* capsule, Quaternion* rotation, UINT64 layer);
  52. static bool internal_ConvexOverlapAny(ScriptPhysicsMesh* mesh, Vector3* position, Quaternion* rotation, UINT64 layer);
  53. };
  54. /** @} */
  55. }