Пример #1
0
        /// <summary>
        /// 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.
        /// </summary>
        /// <param name="mesh">Mesh to sweep through the scene. Must be convex.</param>
        /// <param name="position">Starting position of the mesh.</param>
        /// <param name="rotation">Orientation of the mesh.</param>
        /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
        /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.
        ///                     </param>
        /// <param name="max">Maximum distance at which to perform the query. Hits past this distance will not be detected.
        ///                   </param>
        /// <returns>True if something was hit, false otherwise.</returns>
        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));
        }
Пример #2
0
        /// <summary>
        /// Checks if the provided convex mesh overlaps any other collider in the scene.
        /// </summary>
        /// <param name="mesh">Mesh to check for overlap. Must be convex.</param>
        /// <param name="position">Position of the mesh.</param>
        /// <param name="rotation">Orientation of the mesh.</param>
        /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.
        ///                     </param>
        /// <returns>True if there is overlap with another object, false otherwise.</returns>
        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));
        }
Пример #3
0
        /// <summary>
        /// Performs a sweep into the scene using a convex mesh and returns the closest found hit, if any.
        /// </summary>
        /// <param name="mesh">Mesh to sweep through the scene. Must be convex.</param>
        /// <param name="position">Starting position of the mesh.</param>
        /// <param name="rotation">Orientation of the mesh.</param>
        /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
        /// <param name="hit">Information recorded about a hit. Only valid if method returns true.</param>
        /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.
        ///                     </param>
        /// <param name="max">Maximum distance at which to perform the query. Hits past this distance will not be detected.
        ///                   </param>
        /// <returns>True if something was hit, false otherwise.</returns>
        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);
        }
Пример #4
0
        /// <summary>
        /// Checks if the provided convex mesh overlaps any other collider in the scene.
        /// </summary>
        /// <param name="mesh">Mesh to check for overlap. Must be convex.</param>
        /// <param name="position">Position of the mesh.</param>
        /// <param name="rotation">Orientation of the mesh.</param>
        /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.
        ///                     </param>
        /// <returns>True if there is overlap with another object, false otherwise.</returns>
        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);
        }
Пример #5
0
        /// <summary>
        /// Returns a list of all colliders in the scene that overlap the provided convex mesh.
        /// </summary>
        /// <param name="mesh">Mesh to check for overlap. Must be convex.</param>
        /// <param name="position">Position of the mesh.</param>
        /// <param name="rotation">Orientation of the mesh.</param>
        /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.
        ///                     </param>
        /// <returns>List of all colliders that overlap the mesh.</returns>
        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));
        }
Пример #6
0
        /// <summary>
        /// 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.
        /// </summary>
        /// <param name="mesh">Mesh to sweep through the scene. Must be convex.</param>
        /// <param name="position">Starting position of the mesh.</param>
        /// <param name="rotation">Orientation of the mesh.</param>
        /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
        /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.
        ///                     </param>
        /// <param name="max">Maximum distance at which to perform the query. Hits past this distance will not be detected.
        ///                   </param>
        /// <returns>True if something was hit, false otherwise.</returns>
        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);
        }
Пример #7
0
        /// <summary>
        /// Performs a sweep into the scene using a convex mesh and returns the closest found hit, if any.
        /// </summary>
        /// <param name="mesh">Mesh to sweep through the scene. Must be convex.</param>
        /// <param name="position">Starting position of the mesh.</param>
        /// <param name="rotation">Orientation of the mesh.</param>
        /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
        /// <param name="hit">Information recorded about a hit. Only valid if method returns true.</param>
        /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.
        ///                     </param>
        /// <param name="max">Maximum distance at which to perform the query. Hits past this distance will not be detected.
        ///                   </param>
        /// <returns>True if something was hit, false otherwise.</returns>
        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;
        }
 private static extern void Internal_setMesh(IntPtr thisPtr, PhysicsMesh mesh);
 private static extern void Internal_create(PhysicsMesh managedInstance, MeshData meshData, PhysicsMeshType type);
Пример #10
0
 private static extern bool Internal_convexOverlapAny(PhysicsMesh mesh, ref Vector3 position, ref Quaternion rotation, ulong layer);
Пример #11
0
 private static extern Collider[] Internal_convexOverlap(PhysicsMesh mesh, ref Vector3 position, ref Quaternion rotation, ulong layer);
Пример #12
0
 private static extern bool Internal_convexCastAny(PhysicsMesh mesh, ref Vector3 position, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max);
Пример #13
0
 private static extern PhysicsQueryHit[] Internal_convexCastAll(PhysicsMesh mesh, ref Vector3 position, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max);
Пример #14
0
 /// <summary>Checks if the provided convex mesh overlaps any other collider in the scene.</summary>
 /// <param name="mesh">Mesh to check for overlap. Must be convex.</param>
 /// <param name="position">Position of the mesh.</param>
 /// <param name="rotation">Orientation of the mesh.</param>
 /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
 /// <returns>True if there is overlap with another object, false otherwise.</returns>
 public static bool ConvexOverlapAny(PhysicsMesh mesh, Vector3 position, Quaternion rotation, ulong layer = 18446744073709551615)
 {
     return(Internal_convexOverlapAny(mesh, ref position, ref rotation, layer));
 }
Пример #15
0
 /// <summary>
 /// 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.
 /// </summary>
 /// <param name="mesh">Mesh to sweep through the scene. Must be convex.</param>
 /// <param name="position">Starting position of the mesh.</param>
 /// <param name="rotation">Orientation of the mesh.</param>
 /// <param name="unitDir">Unit direction towards which to perform the sweep.</param>
 /// <param name="layer">Layers to consider for the query. This allows you to ignore certain groups of objects.</param>
 /// <param name="max">
 /// Maximum distance at which to perform the query. Hits past this distance will not be detected.
 /// </param>
 /// <returns>True if something was hit, false otherwise.</returns>
 public static bool ConvexCastAny(PhysicsMesh mesh, Vector3 position, Quaternion rotation, Vector3 unitDir, ulong layer = 18446744073709551615, float max = 3.40282347E+38f)
 {
     return(Internal_convexCastAny(mesh, ref position, ref rotation, ref unitDir, layer, max));
 }