/// <summary>Initializes the struct with default values.</summary> public static PhysicsQueryHit Default() { PhysicsQueryHit value = new PhysicsQueryHit(); value.point = new Vector3(); value.normal = new Vector3(); value.uv = new Vector2(); value.distance = 0f; value.triangleIdx = 0; value.collider = null; return(value); }
/// <summary>Performs a sweep into the scene using a sphere and returns the closest found hit, if any.</summary> /// <param name="sphere">Sphere to sweep through the scene.</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 bool SphereCast(Sphere sphere, Vector3 unitDir, out PhysicsQueryHit hit, ulong layer = 18446744073709551615, float max = 3.40282347E+38f) { return(Internal_sphereCast(mCachedPtr, ref sphere, ref unitDir, out hit, layer, max)); }
/// <summary>Casts a ray into the scene and returns the closest found hit, if any.</summary> /// <param name="origin">Origin of the ray to cast into the scene.</param> /// <param name="unitDir">Unit direction of the ray to cast into the scene.</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 bool RayCast(Vector3 origin, Vector3 unitDir, out PhysicsQueryHit hit, ulong layer = 18446744073709551615, float max = 3.40282347E+38f) { return(Internal_rayCast0(mCachedPtr, ref origin, ref unitDir, out hit, layer, max)); }
/// <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 bool BoxCast(AABox box, Quaternion rotation, Vector3 unitDir, out PhysicsQueryHit hit, ulong layer = 18446744073709551615, float max = 3.40282347E+38f) { return(Internal_boxCast(mCachedPtr, ref box, ref rotation, ref unitDir, out hit, layer, max)); }
private static extern bool Internal_convexCast(IntPtr thisPtr, RRef <PhysicsMesh> mesh, ref Vector3 position, ref Quaternion rotation, ref Vector3 unitDir, out PhysicsQueryHit hit, ulong layer, float max);
/// <summary>Casts a ray into the scene and returns the closest found hit, if any.</summary> /// <param name="ray">Ray to cast into the scene.</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 bool RayCast(Ray ray, out PhysicsQueryHit hit, ulong layer = 18446744073709551615, float max = 3.40282347E+38f) { return(Internal_rayCast(mCachedPtr, ref ray, out hit, layer, max)); }
private static extern bool Internal_sphereCast(IntPtr thisPtr, ref Sphere sphere, ref Vector3 unitDir, out PhysicsQueryHit hit, ulong layer, float max);
private static extern bool Internal_capsuleCast(IntPtr thisPtr, ref Capsule capsule, ref Quaternion rotation, ref Vector3 unitDir, out PhysicsQueryHit hit, ulong layer, float max);
private static extern bool Internal_boxCast(IntPtr thisPtr, ref AABox box, ref Quaternion rotation, ref Vector3 unitDir, out PhysicsQueryHit hit, ulong layer, float max);
private static extern bool Internal_rayCast0(IntPtr thisPtr, ref Vector3 origin, ref Vector3 unitDir, out PhysicsQueryHit hit, ulong layer, float max);
private static extern bool Internal_rayCast(IntPtr thisPtr, ref Ray ray, out PhysicsQueryHit hit, ulong layer, float max);
/// <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 bool ConvexCast(RRef <PhysicsMesh> mesh, Vector3 position, Quaternion rotation, Vector3 unitDir, out PhysicsQueryHit hit, ulong layer = 18446744073709551615, float max = 3.40282347E+38f) { return(Internal_convexCast(mCachedPtr, mesh, ref position, ref rotation, ref unitDir, out hit, layer, max)); }
/// <summary>Performs a sweep into the scene using a capsule and returns the closest found hit, if any.</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="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 CapsuleCast(Capsule capsule, Quaternion rotation, Vector3 unitDir, out PhysicsQueryHit hit, ulong layer = 18446744073709551615, float max = 3.40282347E+38f) { return(Internal_capsuleCast(ref capsule, ref rotation, ref unitDir, out hit, layer, max)); }