In medieval warfare, sturdy stakes were stuck into the ground at the bottom of long lines of ditches, positioned with a sharp end pointing up diagonally, in order to prevent cavalry charges in a given area. Even if the stakes were spotted, horsemen would be forced to dismount and effectively give up their advantage as cavalry, and become easier targets. The correct layout of these extensive lines of ditches and the control of stake size, form and placement were part of the craft of war.
An alternative cavalry deterrent, allowing quicker dispersal and providing the advantage of being hidden more easily, was the deployment of, for example, small balls with spikes, used during most of antiquity. Many variants were used, such as boards with metal hooks, as described as used by Julius Caesar. A  more modern version of this are caltrops.
Passive fortification—ditches and obstacles such as dragon's teeth and Czech hedgehogs—were used as anti-tank measures during World War II.