I'm drawing lines in 2D to represent selections/bounding boxes in 3D, because I can't use GLES3 and there's no line thickness in 3D in GLES2. I unproject the vertices, and go from there. There is one problem, though: when a vertex is behind the camera, the unprojection comes out wrong.
I'm using CanvasItem.draw_polyline(), so if I abort the line drawing when a point is behind the camera, the selection lines will disappear. If I don't, then I get this:

Is there some way to fix this?
It seems to me that all the lines that are wrong (the ones converging at the center of the screen) all follow the exact opposite direction that they would if they were ok. Maybe there is some way I could rotate them 180ยบ? I tried rotating the unprojected vector of the end-point (the one behind the camera) but the results weren't any good.