Physics.generated.cs 29 KB

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