/// <summary> /// Creates a raycast /// </summary> /// <param name="origin">the origin of the raycast</param> /// <param name="direction">the direction of the raycast</param> /// <param name="hit">returns the hit data</param> /// <param name="distance">max distance</param> /// <param name="mask">layerMask</param> /// <param name="offset">raycast offset</param> /// <returns>did we hit something?</returns> public static bool Raycast(Vector3 origin, Vector3 direction, out UNPhysicsHit_Grass hit, float distance, int mask, float offset) { UNPhysicsHitsArray hits = RaycastAll(origin, direction, distance, mask, offset); hit = new UNPhysicsHit_Grass(); if (hits.Count <= 0) { return(false); } hits.Sort(); hit = hits[0]; return(true); }
/// <summary> /// Raycast the physics object /// </summary> /// <param name="origin">ray origin</param> /// <param name="direction">ray direction</param> /// <param name="_hit">hit data</param> /// <param name="distance">max distance</param> /// <param name="mask">layerMask</param> /// <returns>Did we hit something?</returns> public bool Raycast(Ray ray, out UNPhysicsHit_Grass _hit, LayerMask mask) { _hit = hit; if (!enabled) { return(false); } if (Bounds.IntersectRay(ray, out _hit.distance)) { _hit.point = ray.GetPoint(_hit.distance); return(true); //return VerifyUnityCollisions(_hit, ray); } return(false); }
public void AddToList(UNPhysicsHit_Grass hit) { _data.Add(hit); }
/// <summary> /// Creates a raycast /// </summary> /// <param name="ray">the ray of the raycast</param> /// <param name="hit">returns the hit data</param> /// <param name="distance">max distance</param> /// <param name="mask">layerMask</param> /// <returns>did we hit something?</returns> public static bool Raycast(Ray ray, out UNPhysicsHit_Grass hit, float distance, int mask) { return(Raycast(ray.origin, ray.direction, out hit, distance, mask)); }
/// <summary> /// Creates a raycast /// </summary> /// <param name="ray">the ray of the raycast</param> /// <param name="hit">the hit data</param> /// <param name="distance">max distance</param> /// <returns></returns> public static bool Raycast(Ray ray, out UNPhysicsHit_Grass hit, float distance, bool TakeUnityPhysicsIntoAccount, Transform target) { return(Raycast(ray.origin, ray.direction, out hit, distance, -1)); }
/// <summary> /// Creates a raycast /// </summary> /// <param name="origin">The origin of the ray</param> /// <param name="direction">The direction of the ray</param> /// <param name="hit">The hit data of the ray</param> /// <param name="distance">max distance</param> /// <returns>did we hit something?</returns> public static bool Raycast(Vector3 origin, Vector3 direction, out UNPhysicsHit_Grass hit, float distance) { return(Raycast(origin, direction, out hit, distance, -1)); }