Unfortunately, the whole trench run makes very little sense in light of real-world technological advancements. Even in the 21st century, precision strike missiles can hit relatively small stationary targets from significant distances away. The latest precision strike missile system from Lockheed Martin claims to be able to accurately hit a target over 400 kilometers away, with a CEP (circular error probable) of about 1 meter. Granted, those missiles are designed to be fired from the ground, but even the much older Raytheon AGM-65 series systems, which are designed to be fired from a moving plane, can hit targets 25 kilometers away with a CEP of about 1.5 meters. So even with current technology, the 2-meter wide shaft on the Death Star would be possible to hit from at least 25 kilometers away. And obviously, the chances of hitting it directly would approach 100% if you fired at it multiple times.
Additionally, these 21st century missiles are designed for precision strikes inside a gravity well and atmosphere, meaning that calculations must account for the Earth’s gravity and curvature, air currents and weather conditions. But none of that would apply in the vacuum of space, so the calculations for a precision strike would be even easier and the strike accuracy would be much better on average. (Presumably the 140km diameter Death Star creates a negligible gravity well.)
Of course, to be fair, we’re not really comparing apples to apples here, because the goal of the Death Star trench run was not merely to hit the target, but to ensure the torpedo travels in a straight line down the shaft, perpendicular to the trench, for around 70 kilometers until it hits the reactor. Since the X-wing is traveling perpendicular to the shaft a few meters above the trench floor, the torpedo would need to follow a perfect quarter-circle arc, or else magically perform a very tight turn. This would require the torpedo to be fired at exactly the right moment. This seems very difficult to pull off even with some hypothetical super-advanced future targeting system, depending on how fast the X-wings are actually moving. However, assuming the torpedo has its own propulsion and maneuvering systems, the X-wing pilot could simply fire the torpedo well before coming into range of the shaft, and allow the torpedo itself to just travel in a straight line parallel to the trench and then make the quarter-circle arc turn at the right moment, adjusting speed as necessary. (Although admittedly that is probably beyond the capabilities of modern precision missile systems.)
But really, all of this demonstrates that the whole idea of a trench run makes very little sense to begin with. It would make way more sense to just fire multiple torpedoes from hundreds or thousands of kilometers away, in a straight line directly at the shaft. We can speculate that maybe they didn’t do this because the Death Star’s defensive laser turrets would just intercept the torpedoes. But this explanation doesn’t really work because (A) dialogue in A New Hope specifically says the turrets are too slow to reliably hit the small X-wings, so the turrets probably wouldn’t be able to hit every single torpedo if a barrage of them were fired at once, and (B) even if the turrets could reliably intercept every single torpedo, the Rebels could first fly X-wings along the trench with the sole purpose of destroying the surrounding turrets, and then after those turrets are neutralized, fire a barrage of torpedoes directly at the shaft from a distance.
Of course, then Luke wouldn’t fulfill his hero’s journey, and that would totally suck. So let’s just ignore this entire post.