Physics.generated.cs 29 KB

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