//********************************** Banshee Engine (www.banshee3d.com) **************************************************// //**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************// using System; using System.Runtime.CompilerServices; namespace BansheeEngine { /** @addtogroup Physics * @{ */ /// /// Provides global access to the physics system, including scene queries and global options. /// public static class Physics { /// /// Global gravity value for all objects in the scene. /// public static Vector3 Gravity { get { Vector3 gravity; Internal_GetGravity(out gravity); return gravity; } set { Internal_SetGravity(ref value); } } /// /// Casts a ray into the scene and returns the closest found hit, if any. /// /// Ray to cast into the scene. /// Information recorded about a hit. Only valid if method returns true. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// True if something was hit, false otherwise. public static bool RayCast(Ray ray, out PhysicsQueryHit hit, ulong layer = ulong.MaxValue, float max = float.MaxValue) { return RayCast(ray.origin, ray.direction, out hit, layer, max); } /// /// Casts a ray into the scene and returns the closest found hit, if any. /// /// Origin of the ray to cast into the scene. /// Unit direction of the ray to cast into the scene. /// Information recorded about a hit. Only valid if method returns true. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// True if something was hit, false otherwise. public static bool RayCast(Vector3 origin, Vector3 unitDir, out PhysicsQueryHit hit, ulong layer = ulong.MaxValue, float max = float.MaxValue) { ScriptPhysicsQueryHit scriptHit = new ScriptPhysicsQueryHit(); if(Internal_RayCast(ref origin, ref unitDir, out scriptHit, layer, max)) { ConvertPhysicsQueryHit(ref scriptHit, out hit); return true; } hit = new PhysicsQueryHit(); return false; } /// /// Performs a sweep into the scene using a box and returns the closest found hit, if any. /// /// Box to sweep through the scene. /// Orientation of the box. /// Unit direction towards which to perform the sweep. /// Information recorded about a hit. Only valid if method returns true. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// True if something was hit, false otherwise. public static bool BoxCast(AABox box, Quaternion rotation, Vector3 unitDir, out PhysicsQueryHit hit, ulong layer = ulong.MaxValue, float max = float.MaxValue) { ScriptPhysicsQueryHit scriptHit = new ScriptPhysicsQueryHit(); if(Internal_BoxCast(ref box, ref rotation, ref unitDir, out scriptHit, layer, max)) { ConvertPhysicsQueryHit(ref scriptHit, out hit); return true; } hit = new PhysicsQueryHit(); return false; } /// /// Performs a sweep into the scene using a sphere and returns the closest found hit, if any. /// /// Sphere to sweep through the scene. /// Unit direction towards which to perform the sweep. /// Information recorded about a hit. Only valid if method returns true. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// True if something was hit, false otherwise. public static bool SphereCast(Sphere sphere, Vector3 unitDir, out PhysicsQueryHit hit, ulong layer = ulong.MaxValue, float max = float.MaxValue) { ScriptPhysicsQueryHit scriptHit = new ScriptPhysicsQueryHit(); if(Internal_SphereCast(ref sphere, ref unitDir, out scriptHit, layer, max)) { ConvertPhysicsQueryHit(ref scriptHit, out hit); return true; } hit = new PhysicsQueryHit(); return false; } /// /// Performs a sweep into the scene using a capsule and returns the closest found hit, if any. /// /// Capsule to sweep through the scene. /// Orientation of the capsule. /// Unit direction towards which to perform the sweep. /// Information recorded about a hit. Only valid if method returns true. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// True if something was hit, false otherwise. public static bool CapsuleCast(Capsule capsule, Quaternion rotation, Vector3 unitDir, out PhysicsQueryHit hit, ulong layer = ulong.MaxValue, float max = float.MaxValue) { ScriptPhysicsQueryHit scriptHit = new ScriptPhysicsQueryHit(); if(Internal_CapsuleCast(ref capsule, ref rotation, ref unitDir, out scriptHit, layer, max)) { ConvertPhysicsQueryHit(ref scriptHit, out hit); return true; } hit = new PhysicsQueryHit(); return false; } /// /// Performs a sweep into the scene using a convex mesh and returns the closest found hit, if any. /// /// Mesh to sweep through the scene. Must be convex. /// Starting position of the mesh. /// Orientation of the mesh. /// Unit direction towards which to perform the sweep. /// Information recorded about a hit. Only valid if method returns true. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// True if something was hit, false otherwise. public static bool ConvexCast(PhysicsMesh mesh, Vector3 position, Quaternion rotation, Vector3 unitDir, out PhysicsQueryHit hit, ulong layer = ulong.MaxValue, float max = float.MaxValue) { IntPtr meshPtr = IntPtr.Zero; if (mesh != null) meshPtr = mesh.GetCachedPtr(); ScriptPhysicsQueryHit scriptHit = new ScriptPhysicsQueryHit(); if(Internal_ConvexCast(meshPtr, ref position, ref rotation, ref unitDir, out scriptHit, layer, max)) { ConvertPhysicsQueryHit(ref scriptHit, out hit); return true; } hit = new PhysicsQueryHit(); return false; } /// /// Casts a ray into the scene and returns all found hits. /// /// Ray to cast into the scene. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// List of all detected hits. public static PhysicsQueryHit[] RayCastAll(Ray ray, ulong layer = ulong.MaxValue, float max = float.MaxValue) { return RayCastAll(ray.origin, ray.direction, layer, max); } /// /// Casts a ray into the scene and returns all found hits. /// /// Origin of the ray to cast into the scene. /// Unit direction of the ray to cast into the scene. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// List of all detected hits. public static PhysicsQueryHit[] RayCastAll(Vector3 origin, Vector3 unitDir, ulong layer = ulong.MaxValue, float max = float.MaxValue) { return ConvertPhysicsQueryHits(Internal_RayCastAll(ref origin, ref unitDir, layer, max)); } /// /// Performs a sweep into the scene using a box and returns all found hits. /// /// Box to sweep through the scene. /// Orientation of the box. /// Unit direction towards which to perform the sweep. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// List of all detected hits. public static PhysicsQueryHit[] BoxCastAll(AABox box, Quaternion rotation, Vector3 unitDir, ulong layer = ulong.MaxValue, float max = float.MaxValue) { return ConvertPhysicsQueryHits(Internal_BoxCastAll(ref box, ref rotation, ref unitDir, layer, max)); } /// /// Performs a sweep into the scene using a sphere and returns all found hits. /// /// Sphere to sweep through the scene. /// Unit direction towards which to perform the sweep. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// List of all detected hits. public static PhysicsQueryHit[] SphereCastAll(Sphere sphere, Vector3 unitDir, ulong layer = ulong.MaxValue, float max = float.MaxValue) { return ConvertPhysicsQueryHits(Internal_SphereCastAll(ref sphere, ref unitDir, layer, max)); } /// /// Performs a sweep into the scene using a capsule and returns all found hits. /// /// Capsule to sweep through the scene. /// Orientation of the capsule. /// Unit direction towards which to perform the sweep. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// List of all detected hits. public static PhysicsQueryHit[] CapsuleCastAll(Capsule capsule, Quaternion rotation, Vector3 unitDir, ulong layer = ulong.MaxValue, float max = float.MaxValue) { return ConvertPhysicsQueryHits(Internal_CapsuleCastAll(ref capsule, ref rotation, ref unitDir, layer, max)); } /// /// Performs a sweep into the scene using a convex mesh and returns all found hits. /// /// Mesh to sweep through the scene. Must be convex. /// Starting position of the mesh. /// Orientation of the mesh. /// Unit direction towards which to perform the sweep. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// List of all detected hits. public static PhysicsQueryHit[] ConvexCastAll(PhysicsMesh mesh, Vector3 position, Quaternion rotation, Vector3 unitDir, ulong layer = ulong.MaxValue, float max = float.MaxValue) { IntPtr meshPtr = IntPtr.Zero; if (mesh != null) meshPtr = mesh.GetCachedPtr(); return ConvertPhysicsQueryHits(Internal_ConvexCastAll(meshPtr, ref position, ref rotation, ref unitDir, layer, max)); } /// /// Casts a ray into the scene and checks if it has hit anything. This can be significantly more efficient than /// other types of cast* calls. /// /// Ray to cast into the scene. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// True if something was hit, false otherwise. public static bool RayCastAny(Ray ray, ulong layer = ulong.MaxValue, float max = float.MaxValue) { return RayCastAny(ray.origin, ray.direction, layer, max); } /// /// Casts a ray into the scene and checks if it has hit anything. This can be significantly more efficient than /// other types of cast* calls. /// /// Origin of the ray to cast into the scene. /// Unit direction of the ray to cast into the scene. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// True if something was hit, false otherwise. public static bool RayCastAny(Vector3 origin, Vector3 unitDir, ulong layer = ulong.MaxValue, float max = float.MaxValue) { return Internal_RayCastAny(ref origin, ref unitDir, layer, max); } /// /// Performs a sweep into the scene using a box and checks if it has hit anything. This can be significantly more /// efficient than other types of cast* calls. /// /// Box to sweep through the scene. /// Orientation of the box. /// Unit direction towards which to perform the sweep. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// True if something was hit, false otherwise. public static bool BoxCastAny(AABox box, Quaternion rotation, Vector3 unitDir, ulong layer = ulong.MaxValue, float max = float.MaxValue) { return Internal_BoxCastAny(ref box, ref rotation, ref unitDir, layer, max); } /// /// Performs a sweep into the scene using a sphere and checks if it has hit anything. This can be significantly more /// efficient than other types of cast* calls. /// /// Sphere to sweep through the scene. /// Unit direction towards which to perform the sweep. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// True if something was hit, false otherwise. public static bool SphereCastAny(Sphere sphere, Vector3 unitDir, ulong layer = ulong.MaxValue, float max = float.MaxValue) { return Internal_SphereCastAny(ref sphere, ref unitDir, layer, max); } /// /// Performs a sweep into the scene using a capsule and checks if it has hit anything. This can be significantly /// more efficient than other types of cast* calls. /// /// Capsule to sweep through the scene. /// Orientation of the capsule. /// Unit direction towards which to perform the sweep. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// True if something was hit, false otherwise. public static bool CapsuleCastAny(Capsule capsule, Quaternion rotation, Vector3 unitDir, ulong layer = ulong.MaxValue, float max = float.MaxValue) { return Internal_CapsuleCastAny(ref capsule, ref rotation, ref unitDir, layer, max); } /// /// Performs a sweep into the scene using a convex mesh and checks if it has hit anything. This can be significantly /// more efficient than other types of cast* calls. /// /// Mesh to sweep through the scene. Must be convex. /// Starting position of the mesh. /// Orientation of the mesh. /// Unit direction towards which to perform the sweep. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// Maximum distance at which to perform the query. Hits past this distance will not be detected. /// /// True if something was hit, false otherwise. public static bool ConvexCastAny(PhysicsMesh mesh, Vector3 position, Quaternion rotation, Vector3 unitDir, ulong layer = ulong.MaxValue, float max = float.MaxValue) { IntPtr meshPtr = IntPtr.Zero; if (mesh != null) meshPtr = mesh.GetCachedPtr(); return Internal_ConvexCastAny(meshPtr, ref position, ref rotation, ref unitDir, layer, max); } /// /// Returns a list of all colliders in the scene that overlap the provided box. /// /// Box to check for overlap. /// Orientation of the box. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// List of all colliders that overlap the box. public static Collider[] BoxOverlap(AABox box, Quaternion rotation, ulong layer = ulong.MaxValue) { return ConvertColliders(Internal_BoxOverlap(ref box, ref rotation, layer)); } /// /// Returns a list of all colliders in the scene that overlap the provided sphere. /// /// Sphere to check for overlap. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// List of all colliders that overlap the sphere. public static Collider[] SphereOverlap(Sphere sphere, ulong layer = ulong.MaxValue) { return ConvertColliders(Internal_SphereOverlap(ref sphere, layer)); } /// /// Returns a list of all colliders in the scene that overlap the provided capsule. /// /// Capsule to check for overlap. /// Orientation of the capsule. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// List of all colliders that overlap the sphere. public static Collider[] CapsuleOverlap(Capsule capsule, Quaternion rotation, ulong layer = ulong.MaxValue) { return ConvertColliders(Internal_CapsuleOverlap(ref capsule, ref rotation, layer)); } /// /// Returns a list of all colliders in the scene that overlap the provided convex mesh. /// /// Mesh to check for overlap. Must be convex. /// Position of the mesh. /// Orientation of the mesh. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// List of all colliders that overlap the mesh. public static Collider[] ConvexOverlap(PhysicsMesh mesh, Vector3 position, Quaternion rotation, ulong layer = ulong.MaxValue) { IntPtr meshPtr = IntPtr.Zero; if (mesh != null) meshPtr = mesh.GetCachedPtr(); return ConvertColliders(Internal_ConvexOverlap(meshPtr, ref position, ref rotation, layer)); } /// /// Checks if the provided box overlaps any other collider in the scene. /// /// Box to check for overlap. /// Orientation of the box. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// True if there is overlap with another object, false otherwise. public static bool BoxOverlapAny(AABox box, Quaternion rotation, ulong layer = ulong.MaxValue) { return Internal_BoxOverlapAny(ref box, ref rotation, layer); } /// /// Checks if the provided sphere overlaps any other collider in the scene. /// /// Sphere to check for overlap. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// True if there is overlap with another object, false otherwise. public static bool SphereOverlapAny(Sphere sphere, ulong layer = ulong.MaxValue) { return Internal_SphereOverlapAny(ref sphere, layer); } /// /// Checks if the provided capsule overlaps any other collider in the scene. /// /// Capsule to check for overlap. /// Orientation of the capsule. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// True if there is overlap with another object, false otherwise. public static bool CapsuleOverlapAny(Capsule capsule, Quaternion rotation, ulong layer = ulong.MaxValue) { return Internal_CapsuleOverlapAny(ref capsule, ref rotation, layer); } /// /// Checks if the provided convex mesh overlaps any other collider in the scene. /// /// Mesh to check for overlap. Must be convex. /// Position of the mesh. /// Orientation of the mesh. /// Layers to consider for the query. This allows you to ignore certain groups of objects. /// /// True if there is overlap with another object, false otherwise. public static bool ConvexOverlapAny(PhysicsMesh mesh, Vector3 position, Quaternion rotation, ulong layer = ulong.MaxValue) { IntPtr meshPtr = IntPtr.Zero; if (mesh != null) meshPtr = mesh.GetCachedPtr(); return Internal_ConvexOverlapAny(meshPtr, ref position, ref rotation, layer); } /// /// Adds a new physics region. Certain physics options require you to set up regions in which physics objects are /// allowed to be in, and objects outside of these regions will not be handled by physics.You do not need to set /// up these regions by default. /// /// Region of space that physics objects are allowed to be in. /// A unique handle to the region. public static int AddPhysicsRegion(AABox region) { return Internal_AddPhysicsRegion(ref region); } /// /// Removes a physics region. /// /// Handle of the region returned by public static void RemovePhysicsRegion(int handle) { Internal_RemovePhysicsRegion(handle); } /// /// Removes all physics regions. /// public static void ClearPhysicsRegions() { Internal_ClearPhysicsRegions(); } /// /// Enables or disables collision between two layers. Each physics object can be assigned a specific layer, and here /// you can determine which layers can interact with each other. /// /// First collision layer. /// Second collision layer. /// True if the layers are allowed to interact, false otherwise. public static void ToggleCollision(ulong layerA, ulong layerB, bool enabled) { Internal_ToggleCollision(layerA, layerB, enabled); } /// /// Checks if two collision layers are allowed to interact. /// /// First collision layer. /// Second collision layer. /// True if the two provided layers are allowed to interact. public static bool IsCollisionEnabled(ulong layerA, ulong layerB) { return Internal_IsCollisionEnabled(layerA, layerB); } /// /// Checks is the physics simulation update currently in progress. /// internal static bool IsUpdateInProgress { get { return Internal_IsUpdateInProgress(); } } /// /// Converts a physics query hit info retrieved from native code into managed physics query hit. /// /// Native physics query hit info. /// Managed physics query hit info private static void ConvertPhysicsQueryHit(ref ScriptPhysicsQueryHit scriptHit, out PhysicsQueryHit hit) { if (scriptHit.collider != null) hit.collider = scriptHit.collider.Component; else hit.collider = null; hit.distance = scriptHit.distance; hit.normal = scriptHit.normal; hit.point = scriptHit.point; hit.triangleIdx = scriptHit.triangleIdx; hit.uv = scriptHit.uv; } /// /// Converts all provided physics query hit infos retrieved from native code into managed physics query hits. /// /// Native physics query hits. /// Converted managed physics query hits. private static PhysicsQueryHit[] ConvertPhysicsQueryHits(ScriptPhysicsQueryHit[] scriptHits) { PhysicsQueryHit[] output = new PhysicsQueryHit[scriptHits.Length]; for (int i = 0; i < scriptHits.Length; i++) ConvertPhysicsQueryHit(ref scriptHits[i], out output[i]); return output; } /// /// Converts an array of native colliders to collider components. /// /// Native colliders. /// Managed collider components. private static Collider[] ConvertColliders(NativeCollider[] colliders) { Collider[] output = new Collider[colliders.Length]; for (int i = 0; i < colliders.Length; i++) output[i] = colliders[i].Component; return output; } [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_GetGravity(out Vector3 gravity); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_SetGravity(ref Vector3 gravity); [MethodImpl(MethodImplOptions.InternalCall)] private static extern int Internal_AddPhysicsRegion(ref AABox region); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_RemovePhysicsRegion(int handle); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_ClearPhysicsRegions(); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_ToggleCollision(ulong layerA, ulong layerB, bool enabled); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_IsCollisionEnabled(ulong layerA, ulong layerB); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_IsUpdateInProgress(); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_RayCast(ref Vector3 origin, ref Vector3 unitDir, out ScriptPhysicsQueryHit hit, ulong layer, float max); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_BoxCast(ref AABox box, ref Quaternion rotation, ref Vector3 unitDir, out ScriptPhysicsQueryHit hit, ulong layer, float max); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_SphereCast(ref Sphere sphere, ref Vector3 unitDir, out ScriptPhysicsQueryHit hit, ulong layer, float max); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_CapsuleCast(ref Capsule capsule, ref Quaternion rotation, ref Vector3 unitDir, out ScriptPhysicsQueryHit hit, ulong layer, float max); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_ConvexCast(IntPtr mesh, ref Vector3 position, ref Quaternion rotation, ref Vector3 unitDir, out ScriptPhysicsQueryHit hit, ulong layer, float max); [MethodImpl(MethodImplOptions.InternalCall)] private static extern ScriptPhysicsQueryHit[] Internal_RayCastAll(ref Vector3 origin, ref Vector3 unitDir, ulong layer, float max); [MethodImpl(MethodImplOptions.InternalCall)] private static extern ScriptPhysicsQueryHit[] Internal_BoxCastAll(ref AABox box, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max); [MethodImpl(MethodImplOptions.InternalCall)] private static extern ScriptPhysicsQueryHit[] Internal_SphereCastAll(ref Sphere sphere, ref Vector3 unitDir, ulong layer, float max); [MethodImpl(MethodImplOptions.InternalCall)] private static extern ScriptPhysicsQueryHit[] Internal_CapsuleCastAll(ref Capsule capsule, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max); [MethodImpl(MethodImplOptions.InternalCall)] private static extern ScriptPhysicsQueryHit[] Internal_ConvexCastAll(IntPtr mesh, ref Vector3 position, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_RayCastAny(ref Vector3 origin, ref Vector3 unitDir, ulong layer, float max); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_BoxCastAny(ref AABox box, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_SphereCastAny(ref Sphere sphere, ref Vector3 unitDir, ulong layer, float max); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_CapsuleCastAny(ref Capsule capsule, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_ConvexCastAny(IntPtr mesh, ref Vector3 position, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max); [MethodImpl(MethodImplOptions.InternalCall)] private static extern NativeCollider[] Internal_BoxOverlap(ref AABox box, ref Quaternion rotation, ulong layer); [MethodImpl(MethodImplOptions.InternalCall)] private static extern NativeCollider[] Internal_SphereOverlap(ref Sphere sphere, ulong layer); [MethodImpl(MethodImplOptions.InternalCall)] private static extern NativeCollider[] Internal_CapsuleOverlap(ref Capsule capsule, ref Quaternion rotation, ulong layer); [MethodImpl(MethodImplOptions.InternalCall)] private static extern NativeCollider[] Internal_ConvexOverlap(IntPtr mesh, ref Vector3 position, ref Quaternion rotation, ulong layer); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_BoxOverlapAny(ref AABox box, ref Quaternion rotation, ulong layer); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_SphereOverlapAny(ref Sphere sphere, ulong layer); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_CapsuleOverlapAny(ref Capsule capsule, ref Quaternion rotation, ulong layer); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool Internal_ConvexOverlapAny(IntPtr mesh, ref Vector3 position, ref Quaternion rotation, ulong layer); } /** @} */ }