Ejemplo n.º 1
0
    /// <summary>
    /// Will return true if is obj in btw 'origin' and 'target' on the 'layer' specified
    /// </summary>
    /// <param name="origin"></param>
    /// <param name="target"></param>
    /// <param name="layer"></param>
    /// <returns></returns>
    static bool IsLayerInBtw(Vector3 origin, Vector3 target, int layer)
    {
        var hit = URayCast.FindObjOnMyWay(origin, target, layer, Color.magenta);

        if (hit.transform == null)
        {
            return(false);
        }

        var distBtwOriAndTarg = Vector3.Distance(origin, target);
        var distBwtOriAndHit  = Vector3.Distance(origin, hit.point);

        // UVisHelp.CreateHelpers(hit.point, Root.yellowSphereHelp);

        if (distBwtOriAndHit > distBtwOriAndTarg)
        {
            return(false);
        }

        return(true);
    }
Ejemplo n.º 2
0
 private RaycastHit TryReachOther(Vector3 a, Vector3 b)
 {
     return(URayCast.FindObjOnMyWay(a, b, 4, Color.magenta));//4 is the Water Layer index
 }