Living roots grow in soil, which is a heterogeneous environment containing a wide variety of physical barriers. Roots must avoid these barriers to grow: first, they adopt a characteristic S-shape that can be described by the angle between the root tip and the barrier (i.e., the tip-to-barrier angle); then, they move parallel to the barrier by keeping the sensitive tip in contact with the barrier until it has been circumvented. We investigated this avoidance response in the primary roots of maize (Zea mays) by considering flat barriers oriented at 45, 60 and 90 degrees with respect to the gravity vector. We measured the root tip orientation during growth by using time-lapse imaging and specially developed tip-tracking software (9 trials for each value of the barrier orientation). Remarkably, we found that the S-shapes formed by the roots were characterized by the same tip-to-barrier angle regardless of the barrier orientation: namely, 21.96 +/- 2.97, 21.48 +/- 4.75 and 20.81 +/- 9.39 degrees for barriers oriented at 45, 60 and 90 degrees, respectively. We also considered the root growth after bypassing the barrier; for the barrier at 90 degrees, we observed a gravitropic recovery. Furthermore, we used a mathematical model to quantify the characteristic time of S-shape formation (95 min on average) and gravitropic recovery (approximately 42 min); the obtained values are consistent with those of previous studies. Our results suggest that the avoidance response develops with respect to a reference frame associated with the barrier. From a biological viewpoint, the reason the root adopts the specifically observed tip-to-barrier angle is unclear, but we speculate that maize root optimizes energy expenditure during the penetration of a medium.