Exemplo n.º 1
0
        /// <summary>
        /// Performs a sweep into the scene using a box and returns the closest found hit, if any.
        /// </summary>
        /// <param name="box">Box to sweep through the scene.</param>
        /// <param name="rotation">Orientation of the box.</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 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;
        }
Exemplo n.º 2
0
 private static extern void Internal_SetTransform(IntPtr thisPtr, ref Vector3 pos, ref Quaternion rot);
Exemplo n.º 3
0
 private static extern NativeCollider[] Internal_ConvexOverlap(IntPtr mesh, ref Vector3 position, ref Quaternion rotation, ulong layer);
Exemplo n.º 4
0
 private static extern bool Internal_CapsuleOverlapAny(ref Capsule capsule, ref Quaternion rotation, ulong layer);
Exemplo n.º 5
0
 private static extern ScriptPhysicsQueryHit[] Internal_ConvexCastAll(IntPtr mesh, ref Vector3 position, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max);
Exemplo n.º 6
0
 private static extern bool Internal_CapsuleCast(ref Capsule capsule, ref Quaternion rotation, ref Vector3 unitDir, out ScriptPhysicsQueryHit hit, ulong layer, float max);
Exemplo n.º 7
0
 private static extern bool Internal_CapsuleCastAny(ref Capsule capsule, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max);
Exemplo n.º 8
0
 /// <summary>
 /// Returns a list of all colliders in the scene that overlap the provided capsule.
 /// </summary>
 /// <param name="capsule">Capsule to check for overlap.</param>
 /// <param name="rotation">Orientation of the capsule.</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 sphere.</returns>
 public static Collider[] CapsuleOverlap(Capsule capsule, Quaternion rotation, ulong layer = ulong.MaxValue)
 {
     return ConvertColliders(Internal_CapsuleOverlap(ref capsule, ref rotation, layer));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Checks if the provided capsule overlaps any other collider in the scene.
 /// </summary>
 /// <param name="capsule">Capsule to check for overlap.</param>
 /// <param name="rotation">Orientation of the capsule.</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 CapsuleOverlapAny(Capsule capsule, Quaternion rotation, ulong layer = ulong.MaxValue)
 {
     return Internal_CapsuleOverlapAny(ref capsule, ref rotation, layer);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Performs a sweep into the scene using a capsule and returns all found hits.
 /// </summary>
 /// <param name="capsule">Capsule to sweep through the scene.</param>
 /// <param name="rotation">Orientation of the capsule.</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>List of all detected hits.</returns>
 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));
 }
Exemplo n.º 11
0
 /// <summary>
 /// 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.
 /// </summary>
 /// <param name="capsule">Capsule to sweep through the scene.</param>
 /// <param name="rotation">Orientation of the capsule.</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 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);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Checks if the provided box overlaps any other collider in the scene.
 /// </summary>
 /// <param name="box">Box to check for overlap.</param>
 /// <param name="rotation">Orientation of the box.</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 BoxOverlapAny(AABox box, Quaternion rotation, ulong layer = ulong.MaxValue)
 {
     return Internal_BoxOverlapAny(ref box, ref rotation, layer);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Returns a list of all colliders in the scene that overlap the provided box.
 /// </summary>
 /// <param name="box">Box to check for overlap.</param>
 /// <param name="rotation">Orientation of the box.</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 box.</returns>
 public static Collider[] BoxOverlap(AABox box, Quaternion rotation, ulong layer = ulong.MaxValue)
 {
     return ConvertColliders(Internal_BoxOverlap(ref box, ref rotation, layer));
 }
Exemplo n.º 14
0
 /// <summary>
 /// 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.
 /// </summary>
 /// <param name="box">Box to sweep through the scene.</param>
 /// <param name="rotation">Orientation of the box.</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 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);
 }
Exemplo n.º 15
0
 private static extern NativeCollider[] Internal_BoxOverlap(ref AABox box, ref Quaternion rotation, ulong layer);
Exemplo n.º 16
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;
        }
Exemplo n.º 17
0
 private static extern bool Internal_BoxOverlapAny(ref AABox box, ref Quaternion rotation, ulong layer);
Exemplo n.º 18
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);
        }
Exemplo n.º 19
0
 private static extern ScriptPhysicsQueryHit[] Internal_CapsuleCastAll(ref Capsule capsule, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max);
Exemplo n.º 20
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));
        }
Exemplo n.º 21
0
 private static extern NativeCollider[] Internal_CapsuleOverlap(ref Capsule capsule, ref Quaternion rotation, ulong layer);
Exemplo n.º 22
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);
        }
Exemplo n.º 23
0
 private static extern bool Internal_ConvexCast(IntPtr mesh, ref Vector3 position, ref Quaternion rotation, ref Vector3 unitDir, out ScriptPhysicsQueryHit hit, ulong layer, float max);
Exemplo n.º 24
0
 private static extern bool Internal_BoxCast(ref AABox box, ref Quaternion rotation, ref Vector3 unitDir, out ScriptPhysicsQueryHit hit, ulong layer, float max);
Exemplo n.º 25
0
 private static extern bool Internal_ConvexCastAny(IntPtr mesh, ref Vector3 position, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max);
Exemplo n.º 26
0
 private static extern ScriptPhysicsQueryHit[] Internal_BoxCastAll(ref AABox box, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max);
Exemplo n.º 27
0
 private static extern bool Internal_ConvexOverlapAny(IntPtr mesh, ref Vector3 position, ref Quaternion rotation, ulong layer);
Exemplo n.º 28
0
 private static extern bool Internal_BoxCastAny(ref AABox box, ref Quaternion rotation, ref Vector3 unitDir, ulong layer, float max);
Exemplo n.º 29
0
 /// <summary>
 /// Performs a sweep into the scene using a box and returns all found hits.
 /// </summary>
 /// <param name="box">Box to sweep through the scene.</param>
 /// <param name="rotation">Orientation of the box.</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>List of all detected hits.</returns>
 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));
 }
Exemplo n.º 30
0
 private static extern void Internal_SetCenterOfMass(IntPtr thisPtr, ref Vector3 position, ref Quaternion rotation);