Example #1
0
    private bool findObstacle(Vector3 facingDir, out GenericCastHit firstHit)
    {
        facingDir = rb.convertVector(facingDir).normalized;

        /* Create the direction vectors */
        Vector3[] dirs = new Vector3[3];
        dirs[0] = facingDir;

        float orientation = SteeringBasics.vectorToOrientation(facingDir, rb.is3D);

        dirs[1] = SteeringBasics.orientationToVector(orientation + sideWhiskerAngle * Mathf.Deg2Rad, rb.is3D);
        dirs[2] = SteeringBasics.orientationToVector(orientation - sideWhiskerAngle * Mathf.Deg2Rad, rb.is3D);

        return(castWhiskers(dirs, out firstHit));
    }