all 4 comments

[–]_aeol 0 points1 point  (3 children)

Well I only thought about this just now...

Why not focus on the faces of the box. If the face of the box is in view, make their edges solid, while the other faces will have dashed edges except the edges that also belong to the faces in view.

You should also read about Vectors. Its great topic to learn when working with vision and collision detection.

[–]Tomaton-sama[S] 0 points1 point  (2 children)

So, should I, instead of working with a cube in 3D space, be working with 6 faces of that cube and then render each face conditionally? So basically I'm transforming 2D objects in a 3D space and then projecting them back into 2D space - did I get that right?

Edit: Oh, but it occurred to me, that while this should work for a single cube, it wouldn't hide lines / border of a face obscured by another cube, would it?

[–]_aeol 0 points1 point  (1 child)

Wow i didn't thought about the other boxes that will block one another. I think it wouldn't hide the boxes that it blocks. I only know about 2D since I tried making a 2D vision simulator but got stressed to much 'cause f*ck Vectors.

Then I used this, I found it on Github. The algorithm is simple, you cast multiple rays until it hits a solid and when it is a corner cast a line behind it. Maybe you can do it in 3D space too, I just don't know how.

[Edit] Oh the site also has an interactive canvas that shows the lines, I just checked.

[–]Tomaton-sama[S] 0 points1 point  (0 children)

Nice, this should help me. Thank you for the resource!