Physics.generated.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. using System.Runtime.InteropServices;
  4. namespace BansheeEngine
  5. {
  6. /** @addtogroup Physics
  7. * @{
  8. */
  9. /// <summary>Provides global physics settings, factory methods for physics objects and scene queries.</summary>
  10. public partial class Physics : ScriptObject
  11. {
  12. private Physics(bool __dummy0) { }
  13. protected Physics() { }
  14. /// <summary>Determines the global gravity value for all objects in the scene.</summary>
  15. public static Vector3 Gravity
  16. {
  17. get
  18. {
  19. Vector3 temp;
  20. Internal_getGravity(out temp);
  21. return temp;
  22. }
  23. set { Internal_setGravity(ref value); }
  24. }
  25. /// <summary>Checks is the physics simulation update currently in progress.</summary>
  26. public static bool IsUpdateInProgress
  27. {
  28. get { return Internal__isUpdateInProgress(); }
  29. }
  30. /// <summary>Casts a ray into the scene and returns the closest found hit, if any.</summary>
  31. /// <param name="ray">Ray to cast into the scene.</param>
  32. /// <param name="hit">Information recorded about a hit. Only valid if method returns true.</param>
  33. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  34. /// <param name="max">
  35. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  36. /// </param>
  37. /// <returns>True if something was hit, false otherwise.</returns>
  38. public static bool RayCast(Ray ray, out PhysicsQueryHit hit, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  39. {
  40. return Internal_rayCast(ref ray, out hit, layer, max);
  41. }
  42. /// <summary>Casts a ray into the scene and returns the closest found hit, if any.</summary>
  43. /// <param name="origin">Origin of the ray to cast into the scene.</param>
  44. /// <param name="unitDir">Unit direction of the ray to cast into the scene.</param>
  45. /// <param name="hit">Information recorded about a hit. Only valid if method returns true.</param>
  46. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  47. /// <param name="max">
  48. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  49. /// </param>
  50. /// <returns>True if something was hit, false otherwise.</returns>
  51. public static bool RayCast(Vector3 origin, Vector3 unitDir, out PhysicsQueryHit hit, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  52. {
  53. return Internal_rayCast0(ref origin, ref unitDir, out hit, layer, max);
  54. }
  55. /// <summary>Performs a sweep into the scene using a box and returns the closest found hit, if any.</summary>
  56. /// <param name="box">Box to sweep through the scene.</param>
  57. /// <param name="rotation">Orientation of the box.</param>
  58. /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
  59. /// <param name="hit">Information recorded about a hit. Only valid if method returns true.</param>
  60. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  61. /// <param name="max">
  62. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  63. /// </param>
  64. /// <returns>True if something was hit, false otherwise.</returns>
  65. public static bool BoxCast(AABox box, Quaternion rotation, Vector3 unitDir, out PhysicsQueryHit hit, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  66. {
  67. return Internal_boxCast(ref box, ref rotation, ref unitDir, out hit, layer, max);
  68. }
  69. /// <summary>Performs a sweep into the scene using a sphere and returns the closest found hit, if any.</summary>
  70. /// <param name="sphere">Sphere to sweep through the scene.</param>
  71. /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
  72. /// <param name="hit">Information recorded about a hit. Only valid if method returns true.</param>
  73. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  74. /// <param name="max">
  75. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  76. /// </param>
  77. /// <returns>True if something was hit, false otherwise.</returns>
  78. public static bool SphereCast(Sphere sphere, Vector3 unitDir, out PhysicsQueryHit hit, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  79. {
  80. return Internal_sphereCast(ref sphere, ref unitDir, out hit, layer, max);
  81. }
  82. /// <summary>Performs a sweep into the scene using a capsule and returns the closest found hit, if any.</summary>
  83. /// <param name="capsule">Capsule to sweep through the scene.</param>
  84. /// <param name="rotation">Orientation of the capsule.</param>
  85. /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
  86. /// <param name="hit">Information recorded about a hit. Only valid if method returns true.</param>
  87. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  88. /// <param name="max">
  89. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  90. /// </param>
  91. /// <returns>True if something was hit, false otherwise.</returns>
  92. public static bool CapsuleCast(Capsule capsule, Quaternion rotation, Vector3 unitDir, out PhysicsQueryHit hit, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  93. {
  94. return Internal_capsuleCast(ref capsule, ref rotation, ref unitDir, out hit, layer, max);
  95. }
  96. /// <summary>Performs a sweep into the scene using a convex mesh and returns the closest found hit, if any.</summary>
  97. /// <param name="mesh">Mesh to sweep through the scene. Must be convex.</param>
  98. /// <param name="position">Starting position of the mesh.</param>
  99. /// <param name="rotation">Orientation of the mesh.</param>
  100. /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
  101. /// <param name="hit">Information recorded about a hit. Only valid if method returns true.</param>
  102. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  103. /// <param name="max">
  104. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  105. /// </param>
  106. /// <returns>True if something was hit, false otherwise.</returns>
  107. public static bool ConvexCast(PhysicsMesh mesh, Vector3 position, Quaternion rotation, Vector3 unitDir, out PhysicsQueryHit hit, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  108. {
  109. return Internal_convexCast(mesh, ref position, ref rotation, ref unitDir, out hit, layer, max);
  110. }
  111. /// <summary>Casts a ray into the scene and returns all found hits.</summary>
  112. /// <param name="ray">Ray to cast into the scene.</param>
  113. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  114. /// <param name="max">
  115. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  116. /// </param>
  117. /// <returns>List of all detected hits.</returns>
  118. public static PhysicsQueryHit[] RayCastAll(Ray ray, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  119. {
  120. return Internal_rayCastAll(ref ray, layer, max);
  121. }
  122. /// <summary>Casts a ray into the scene and returns all found hits.</summary>
  123. /// <param name="origin">Origin of the ray to cast into the scene.</param>
  124. /// <param name="unitDir">Unit direction of the ray to cast into the scene.</param>
  125. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  126. /// <param name="max">
  127. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  128. /// </param>
  129. /// <returns>List of all detected hits.</returns>
  130. public static PhysicsQueryHit[] RayCastAll(Vector3 origin, Vector3 unitDir, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  131. {
  132. return Internal_rayCastAll0(ref origin, ref unitDir, layer, max);
  133. }
  134. /// <summary>Performs a sweep into the scene using a box and returns all found hits.</summary>
  135. /// <param name="box">Box to sweep through the scene.</param>
  136. /// <param name="rotation">Orientation of the box.</param>
  137. /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
  138. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  139. /// <param name="max">
  140. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  141. /// </param>
  142. /// <returns>List of all detected hits.</returns>
  143. public static PhysicsQueryHit[] BoxCastAll(AABox box, Quaternion rotation, Vector3 unitDir, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  144. {
  145. return Internal_boxCastAll(ref box, ref rotation, ref unitDir, layer, max);
  146. }
  147. /// <summary>Performs a sweep into the scene using a sphere and returns all found hits.</summary>
  148. /// <param name="sphere">Sphere to sweep through the scene.</param>
  149. /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
  150. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  151. /// <param name="max">
  152. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  153. /// </param>
  154. /// <returns>List of all detected hits.</returns>
  155. public static PhysicsQueryHit[] SphereCastAll(Sphere sphere, Vector3 unitDir, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  156. {
  157. return Internal_sphereCastAll(ref sphere, ref unitDir, layer, max);
  158. }
  159. /// <summary>Performs a sweep into the scene using a capsule and returns all found hits.</summary>
  160. /// <param name="capsule">Capsule to sweep through the scene.</param>
  161. /// <param name="rotation">Orientation of the capsule.</param>
  162. /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
  163. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  164. /// <param name="max">
  165. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  166. /// </param>
  167. /// <returns>List of all detected hits.</returns>
  168. public static PhysicsQueryHit[] CapsuleCastAll(Capsule capsule, Quaternion rotation, Vector3 unitDir, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  169. {
  170. return Internal_capsuleCastAll(ref capsule, ref rotation, ref unitDir, layer, max);
  171. }
  172. /// <summary>Performs a sweep into the scene using a convex mesh and returns all found hits.</summary>
  173. /// <param name="mesh">Mesh to sweep through the scene. Must be convex.</param>
  174. /// <param name="position">Starting position of the mesh.</param>
  175. /// <param name="rotation">Orientation of the mesh.</param>
  176. /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
  177. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  178. /// <param name="max">
  179. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  180. /// </param>
  181. /// <returns>List of all detected hits.</returns>
  182. public static PhysicsQueryHit[] ConvexCastAll(PhysicsMesh mesh, Vector3 position, Quaternion rotation, Vector3 unitDir, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  183. {
  184. return Internal_convexCastAll(mesh, ref position, ref rotation, ref unitDir, layer, max);
  185. }
  186. /// <summary>
  187. /// Casts a ray into the scene and checks if it has hit anything. This can be significantly more efficient than other
  188. /// types of cast* calls.
  189. /// </summary>
  190. /// <param name="ray">Ray to cast into the scene.</param>
  191. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  192. /// <param name="max">
  193. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  194. /// </param>
  195. /// <returns>True if something was hit, false otherwise.</returns>
  196. public static bool RayCastAny(Ray ray, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  197. {
  198. return Internal_rayCastAny(ref ray, layer, max);
  199. }
  200. /// <summary>
  201. /// Casts a ray into the scene and checks if it has hit anything. This can be significantly more efficient than other
  202. /// types of cast* calls.
  203. /// </summary>
  204. /// <param name="origin">Origin of the ray to cast into the scene.</param>
  205. /// <param name="unitDir">Unit direction of the ray to cast into the scene.</param>
  206. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  207. /// <param name="max">
  208. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  209. /// </param>
  210. /// <returns>True if something was hit, false otherwise.</returns>
  211. public static bool RayCastAny(Vector3 origin, Vector3 unitDir, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  212. {
  213. return Internal_rayCastAny0(ref origin, ref unitDir, layer, max);
  214. }
  215. /// <summary>
  216. /// Performs a sweep into the scene using a box and checks if it has hit anything. This can be significantly more
  217. /// efficient than other types of cast* calls.
  218. /// </summary>
  219. /// <param name="box">Box to sweep through the scene.</param>
  220. /// <param name="rotation">Orientation of the box.</param>
  221. /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
  222. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  223. /// <param name="max">
  224. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  225. /// </param>
  226. /// <returns>True if something was hit, false otherwise.</returns>
  227. public static bool BoxCastAny(AABox box, Quaternion rotation, Vector3 unitDir, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  228. {
  229. return Internal_boxCastAny(ref box, ref rotation, ref unitDir, layer, max);
  230. }
  231. /// <summary>
  232. /// Performs a sweep into the scene using a sphere and checks if it has hit anything. This can be significantly more
  233. /// efficient than other types of cast* calls.
  234. /// </summary>
  235. /// <param name="sphere">Sphere to sweep through the scene.</param>
  236. /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
  237. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  238. /// <param name="max">
  239. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  240. /// </param>
  241. /// <returns>True if something was hit, false otherwise.</returns>
  242. public static bool SphereCastAny(Sphere sphere, Vector3 unitDir, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  243. {
  244. return Internal_sphereCastAny(ref sphere, ref unitDir, layer, max);
  245. }
  246. /// <summary>
  247. /// Performs a sweep into the scene using a capsule and checks if it has hit anything. This can be significantly more
  248. /// efficient than other types of cast* calls.
  249. /// </summary>
  250. /// <param name="capsule">Capsule to sweep through the scene.</param>
  251. /// <param name="rotation">Orientation of the capsule.</param>
  252. /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
  253. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  254. /// <param name="max">
  255. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  256. /// </param>
  257. /// <returns>True if something was hit, false otherwise.</returns>
  258. public static bool CapsuleCastAny(Capsule capsule, Quaternion rotation, Vector3 unitDir, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  259. {
  260. return Internal_capsuleCastAny(ref capsule, ref rotation, ref unitDir, layer, max);
  261. }
  262. /// <summary>
  263. /// Performs a sweep into the scene using a convex mesh and checks if it has hit anything. This can be significantly more
  264. /// efficient than other types of cast* calls.
  265. /// </summary>
  266. /// <param name="mesh">Mesh to sweep through the scene. Must be convex.</param>
  267. /// <param name="position">Starting position of the mesh.</param>
  268. /// <param name="rotation">Orientation of the mesh.</param>
  269. /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
  270. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  271. /// <param name="max">
  272. /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
  273. /// </param>
  274. /// <returns>True if something was hit, false otherwise.</returns>
  275. public static bool ConvexCastAny(PhysicsMesh mesh, Vector3 position, Quaternion rotation, Vector3 unitDir, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
  276. {
  277. return Internal_convexCastAny(mesh, ref position, ref rotation, ref unitDir, layer, max);
  278. }
  279. /// <summary>Returns a list of all colliders in the scene that overlap the provided box.</summary>
  280. /// <param name="box">Box to check for overlap.</param>
  281. /// <param name="rotation">Orientation of the box.</param>
  282. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  283. /// <returns>List of all colliders that overlap the box.</returns>
  284. public static Collider[] BoxOverlap(AABox box, Quaternion rotation, ulong layer = 18446744073709551615)
  285. {
  286. return Internal_boxOverlap(ref box, ref rotation, layer);
  287. }
  288. /// <summary>Returns a list of all colliders in the scene that overlap the provided sphere.</summary>
  289. /// <param name="sphere">Sphere to check for overlap.</param>
  290. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  291. /// <returns>List of all colliders that overlap the sphere.</returns>
  292. public static Collider[] SphereOverlap(Sphere sphere, ulong layer = 18446744073709551615)
  293. {
  294. return Internal_sphereOverlap(ref sphere, layer);
  295. }
  296. /// <summary>Returns a list of all colliders in the scene that overlap the provided capsule.</summary>
  297. /// <param name="capsule">Capsule to check for overlap.</param>
  298. /// <param name="rotation">Orientation of the capsule.</param>
  299. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  300. /// <returns>List of all colliders that overlap the capsule.</returns>
  301. public static Collider[] CapsuleOverlap(Capsule capsule, Quaternion rotation, ulong layer = 18446744073709551615)
  302. {
  303. return Internal_capsuleOverlap(ref capsule, ref rotation, layer);
  304. }
  305. /// <summary>Returns a list of all colliders in the scene that overlap the provided convex mesh.</summary>
  306. /// <param name="mesh">Mesh to check for overlap. Must be convex.</param>
  307. /// <param name="position">Position of the mesh.</param>
  308. /// <param name="rotation">Orientation of the mesh.</param>
  309. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  310. /// <returns>List of all colliders that overlap the mesh.</returns>
  311. public static Collider[] ConvexOverlap(PhysicsMesh mesh, Vector3 position, Quaternion rotation, ulong layer = 18446744073709551615)
  312. {
  313. return Internal_convexOverlap(mesh, ref position, ref rotation, layer);
  314. }
  315. /// <summary>Checks if the provided box overlaps any other collider in the scene.</summary>
  316. /// <param name="box">Box to check for overlap.</param>
  317. /// <param name="rotation">Orientation of the box.</param>
  318. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  319. /// <returns>True if there is overlap with another object, false otherwise.</returns>
  320. public static bool BoxOverlapAny(AABox box, Quaternion rotation, ulong layer = 18446744073709551615)
  321. {
  322. return Internal_boxOverlapAny(ref box, ref rotation, layer);
  323. }
  324. /// <summary>Checks if the provided sphere overlaps any other collider in the scene.</summary>
  325. /// <param name="sphere">Sphere to check for overlap.</param>
  326. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  327. /// <returns>True if there is overlap with another object, false otherwise.</returns>
  328. public static bool SphereOverlapAny(Sphere sphere, ulong layer = 18446744073709551615)
  329. {
  330. return Internal_sphereOverlapAny(ref sphere, layer);
  331. }
  332. /// <summary>Checks if the provided capsule overlaps any other collider in the scene.</summary>
  333. /// <param name="capsule">Capsule to check for overlap.</param>
  334. /// <param name="rotation">Orientation of the capsule.</param>
  335. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  336. /// <returns>True if there is overlap with another object, false otherwise.</returns>
  337. public static bool CapsuleOverlapAny(Capsule capsule, Quaternion rotation, ulong layer = 18446744073709551615)
  338. {
  339. return Internal_capsuleOverlapAny(ref capsule, ref rotation, layer);
  340. }
  341. /// <summary>Checks if the provided convex mesh overlaps any other collider in the scene.</summary>
  342. /// <param name="mesh">Mesh to check for overlap. Must be convex.</param>
  343. /// <param name="position">Position of the mesh.</param>
  344. /// <param name="rotation">Orientation of the mesh.</param>
  345. /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
  346. /// <returns>True if there is overlap with another object, false otherwise.</returns>
  347. public static bool ConvexOverlapAny(PhysicsMesh mesh, Vector3 position, Quaternion rotation, ulong layer = 18446744073709551615)
  348. {
  349. return Internal_convexOverlapAny(mesh, ref position, ref rotation, layer);
  350. }
  351. /// <summary>
  352. /// Adds a new physics region. Certain physics options require you to set up regions in which physics objects are allowed
  353. /// to be in, and objects outside of these regions will not be handled by physics. You do not need to set up these
  354. /// regions by default.
  355. /// </summary>
  356. public static uint AddPhysicsRegion(AABox region)
  357. {
  358. return Internal_addBroadPhaseRegion(ref region);
  359. }
  360. /// <summary>Removes a physics region.</summary>
  361. public static void RemovePhysicsRegion(uint handle)
  362. {
  363. Internal_removeBroadPhaseRegion(handle);
  364. }
  365. /// <summary>Removes all physics regions.</summary>
  366. public static void ClearPhysicsRegions()
  367. {
  368. Internal_clearBroadPhaseRegions();
  369. }
  370. /// <summary>
  371. /// Enables or disables collision between two layers. Each physics object can be assigned a specific layer, and here you
  372. /// can determine which layers can interact with each other.
  373. /// </summary>
  374. public static void ToggleCollision(ulong groupA, ulong groupB, bool enabled)
  375. {
  376. Internal_toggleCollision(groupA, groupB, enabled);
  377. }
  378. /// <summary>Checks if two collision layers are allowed to interact.</summary>
  379. public static bool IsCollisionEnabled(ulong groupA, ulong groupB)
  380. {
  381. return Internal_isCollisionEnabled(groupA, groupB);
  382. }
  383. [MethodImpl(MethodImplOptions.InternalCall)]
  384. private static extern bool Internal_rayCast(ref Ray ray, out PhysicsQueryHit hit, ulong layer, float max);
  385. [MethodImpl(MethodImplOptions.InternalCall)]
  386. private static extern bool Internal_rayCast0(ref Vector3 origin, ref Vector3 unitDir, out PhysicsQueryHit hit, ulong layer, float max);
  387. [MethodImpl(MethodImplOptions.InternalCall)]
  388. private static extern bool Internal_boxCast(ref AABox box, ref Quaternion rotation, ref Vector3 unitDir, out PhysicsQueryHit hit, ulong layer, float max);
  389. [MethodImpl(MethodImplOptions.InternalCall)]
  390. private static extern bool Internal_sphereCast(ref Sphere sphere, ref Vector3 unitDir, out PhysicsQueryHit hit, ulong layer, float max);
  391. [MethodImpl(MethodImplOptions.InternalCall)]
  392. private static extern bool Internal_capsuleCast(ref Capsule capsule, ref Quaternion rotation, ref Vector3 unitDir, out PhysicsQueryHit hit, ulong layer, float max);
  393. [MethodImpl(MethodImplOptions.InternalCall)]
  394. private static extern bool Internal_convexCast(PhysicsMesh mesh, ref Vector3 position, ref Quaternion rotation, ref Vector3 unitDir, out PhysicsQueryHit hit, ulong layer, float max);
  395. [MethodImpl(MethodImplOptions.InternalCall)]
  396. private static extern PhysicsQueryHit[] Internal_rayCastAll(ref Ray ray, ulong layer, float max);
  397. [MethodImpl(MethodImplOptions.InternalCall)]
  398. private static extern PhysicsQueryHit[] Internal_rayCastAll0(ref Vector3 origin, ref Vector3 unitDir, ulong layer, float max);
  399. [MethodImpl(MethodImplOptions.InternalCall)]
  400. private static extern PhysicsQueryHit[] Internal_boxCastAll(ref AABox box, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max);
  401. [MethodImpl(MethodImplOptions.InternalCall)]
  402. private static extern PhysicsQueryHit[] Internal_sphereCastAll(ref Sphere sphere, ref Vector3 unitDir, ulong layer, float max);
  403. [MethodImpl(MethodImplOptions.InternalCall)]
  404. private static extern PhysicsQueryHit[] Internal_capsuleCastAll(ref Capsule capsule, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max);
  405. [MethodImpl(MethodImplOptions.InternalCall)]
  406. private static extern PhysicsQueryHit[] Internal_convexCastAll(PhysicsMesh mesh, ref Vector3 position, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max);
  407. [MethodImpl(MethodImplOptions.InternalCall)]
  408. private static extern bool Internal_rayCastAny(ref Ray ray, ulong layer, float max);
  409. [MethodImpl(MethodImplOptions.InternalCall)]
  410. private static extern bool Internal_rayCastAny0(ref Vector3 origin, ref Vector3 unitDir, ulong layer, float max);
  411. [MethodImpl(MethodImplOptions.InternalCall)]
  412. private static extern bool Internal_boxCastAny(ref AABox box, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max);
  413. [MethodImpl(MethodImplOptions.InternalCall)]
  414. private static extern bool Internal_sphereCastAny(ref Sphere sphere, ref Vector3 unitDir, ulong layer, float max);
  415. [MethodImpl(MethodImplOptions.InternalCall)]
  416. private static extern bool Internal_capsuleCastAny(ref Capsule capsule, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max);
  417. [MethodImpl(MethodImplOptions.InternalCall)]
  418. private static extern bool Internal_convexCastAny(PhysicsMesh mesh, ref Vector3 position, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max);
  419. [MethodImpl(MethodImplOptions.InternalCall)]
  420. private static extern Collider[] Internal_boxOverlap(ref AABox box, ref Quaternion rotation, ulong layer);
  421. [MethodImpl(MethodImplOptions.InternalCall)]
  422. private static extern Collider[] Internal_sphereOverlap(ref Sphere sphere, ulong layer);
  423. [MethodImpl(MethodImplOptions.InternalCall)]
  424. private static extern Collider[] Internal_capsuleOverlap(ref Capsule capsule, ref Quaternion rotation, ulong layer);
  425. [MethodImpl(MethodImplOptions.InternalCall)]
  426. private static extern Collider[] Internal_convexOverlap(PhysicsMesh mesh, ref Vector3 position, ref Quaternion rotation, ulong layer);
  427. [MethodImpl(MethodImplOptions.InternalCall)]
  428. private static extern bool Internal_boxOverlapAny(ref AABox box, ref Quaternion rotation, ulong layer);
  429. [MethodImpl(MethodImplOptions.InternalCall)]
  430. private static extern bool Internal_sphereOverlapAny(ref Sphere sphere, ulong layer);
  431. [MethodImpl(MethodImplOptions.InternalCall)]
  432. private static extern bool Internal_capsuleOverlapAny(ref Capsule capsule, ref Quaternion rotation, ulong layer);
  433. [MethodImpl(MethodImplOptions.InternalCall)]
  434. private static extern bool Internal_convexOverlapAny(PhysicsMesh mesh, ref Vector3 position, ref Quaternion rotation, ulong layer);
  435. [MethodImpl(MethodImplOptions.InternalCall)]
  436. private static extern void Internal_getGravity(out Vector3 __output);
  437. [MethodImpl(MethodImplOptions.InternalCall)]
  438. private static extern void Internal_setGravity(ref Vector3 gravity);
  439. [MethodImpl(MethodImplOptions.InternalCall)]
  440. private static extern uint Internal_addBroadPhaseRegion(ref AABox region);
  441. [MethodImpl(MethodImplOptions.InternalCall)]
  442. private static extern void Internal_removeBroadPhaseRegion(uint handle);
  443. [MethodImpl(MethodImplOptions.InternalCall)]
  444. private static extern void Internal_clearBroadPhaseRegions();
  445. [MethodImpl(MethodImplOptions.InternalCall)]
  446. private static extern void Internal_toggleCollision(ulong groupA, ulong groupB, bool enabled);
  447. [MethodImpl(MethodImplOptions.InternalCall)]
  448. private static extern bool Internal_isCollisionEnabled(ulong groupA, ulong groupB);
  449. [MethodImpl(MethodImplOptions.InternalCall)]
  450. private static extern bool Internal__isUpdateInProgress();
  451. }
  452. /** @} */
  453. }