/// <summary> /// Performs a sweep test against objects in the scene using a box geometry. /// </summary> /// <param name="center">The box center.</param> /// <param name="halfExtents">The half size of the box in each direction.</param> /// <param name="direction">The normalized direction in which cast a box.</param> /// <param name="hitInfo">The result hit information. Valid only when method returns true.</param> /// <param name="rotation">The box rotation.</param> /// <param name="maxDistance">The maximum distance the ray should check for collisions.</param> /// <param name="layerMask">The layer mask used to filter the results.</param> /// <param name="hitTriggers">If set to <c>true</c> triggers will be hit, otherwise will skip them.</param> /// <returns>True if box hits an matching object, otherwise false.</returns> public static bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, out RayCastHit hitInfo, Quaternion rotation, float maxDistance = float.MaxValue, int layerMask = int.MaxValue, bool hitTriggers = true) { return(Internal_BoxCast2(ref center, ref halfExtents, ref direction, out hitInfo, ref rotation, maxDistance, layerMask, hitTriggers)); }
internal static extern bool Internal_SphereCast2(ref Vector3 center, float radius, ref Vector3 direction, out RayCastHit hitInfo, float maxDistance, int layerMask, bool hitTriggers);
/// <summary> /// Performs a raycast against objects in the scene, returns results in a RaycastHit structure. /// </summary> /// <param name="origin">The origin of the ray.</param> /// <param name="direction">The normalized direction of the ray.</param> /// <param name="hitInfo">The result hit information. Valid only when method returns true.</param> /// <param name="maxDistance">The maximum distance the ray should check for collisions.</param> /// <param name="layerMask">The layer mask used to filter the results.</param> /// <param name="hitTriggers">If set to <c>true</c> triggers will be hit, otherwise will skip them.</param> /// <returns>True if ray hits an matching object, otherwise false.</returns> public static bool RayCast(Vector3 origin, Vector3 direction, out RayCastHit hitInfo, float maxDistance = float.MaxValue, int layerMask = int.MaxValue, bool hitTriggers = true) { return(Internal_RayCast2(ref origin, ref direction, out hitInfo, maxDistance, layerMask, hitTriggers)); }
internal static extern bool Internal_BoxCast2(ref Vector3 center, ref Vector3 halfExtents, ref Vector3 direction, out RayCastHit hitInfo, ref Quaternion rotation, float maxDistance, int layerMask, bool hitTriggers);
internal static extern bool Internal_RayCast2(ref Vector3 origin, ref Vector3 direction, out RayCastHit hitInfo, float maxDistance, int layerMask, bool hitTriggers);
/// <summary> /// Performs a sweep test against objects in the scene using a sphere geometry. /// </summary> /// <param name="center">The sphere center.</param> /// <param name="radius">The radius of the sphere.</param> /// <param name="direction">The normalized direction in which cast a sphere.</param> /// <param name="hitInfo">The result hit information. Valid only when method returns true.</param> /// <param name="maxDistance">The maximum distance the ray should check for collisions.</param> /// <param name="layerMask">The layer mask used to filter the results.</param> /// <param name="hitTriggers">If set to <c>true</c> triggers will be hit, otherwise will skip them.</param> /// <returns>True if sphere hits an matching object, otherwise false.</returns> public static bool SphereCast(Vector3 center, float radius, Vector3 direction, out RayCastHit hitInfo, float maxDistance = float.MaxValue, int layerMask = int.MaxValue, bool hitTriggers = true) { return(Internal_SphereCast2(ref center, radius, ref direction, out hitInfo, maxDistance, layerMask, hitTriggers)); }
internal static extern bool Internal_RayCast3(IntPtr obj, ref Vector3 origin, ref Vector3 direction, out RayCastHit hitInfo, float maxDistance);
/// <summary> /// Performs a raycast against this collider, returns results in a RaycastHit structure. /// </summary> /// <param name="origin">The origin of the ray.</param> /// <param name="direction">The normalized direction of the ray.</param> /// <param name="hitInfo">The result hit information. Valid only when method returns true.</param> /// <param name="maxDistance">The maximum distance the ray should check for collisions.</param> /// <returns>True if ray hits an object, otherwise false.</returns> public bool RayCast(Vector3 origin, Vector3 direction, out RayCastHit hitInfo, float maxDistance = float.MaxValue) { return(Internal_RayCast3(unmanagedPtr, ref origin, ref direction, out hitInfo, maxDistance)); }