The 3D idea will not work with your plans to stop a walker when crossing another line though
Better stay 2D…
See Vector math for line-to-line intersection