示例#1
0
        /// <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);
        }
示例#2
0
        /// <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);
        }
示例#3
0
 public void AddToList(UNPhysicsHit_Grass hit)
 {
     _data.Add(hit);
 }
示例#4
0
 /// <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));
 }
示例#5
0
 /// <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));
 }
示例#6
0
 /// <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));
 }