There and half-way back

Go forwards till you hit the far wall, counting how far you go.

Spin round 180˚, Divide the distance by 2

Go forward again according to the new count.

You can drag the green walls with the mouse to test different distances.