I am creating a system that lets you place down roads, kinda like in Cities: Skylines. The issue is this gap - I want to fill it between the two parts I have here on the left and right…
(highlight is part of the node system)
In Studio, you can just use GapFill, but I want these gaps to fill themselves as the roads are created by the player, and I don’t know how to code that. You could also resize one of the parts, but that would look sloppy, not work in some cases, and introduce even more Z fighting that I don’t need… I did look around the forums, and even found a similar post, but it sadly has no replies. I don’t know how to code this functionality, so any help will be appreciated. Thanks!
1 Like
I’ll need to look into this more and mess around with it in studio, but I don’t yet have the time. Regardless, i provided an explanation below which provides the rough idea of what you would want to do to achieve your desired effect
Longer response, which has a couple issues but gives the general idea
Short on time, so I can’t provide a better explanation, but:
What you would want to do is create a wedge part (part with shape set to wedge), which is rotated such that the top down view of it is a triangle. You then need to position it at the same position of that sphere you have in your screenshot. The size in 1 axis would be twice the distance between the point where the sphere is, and the point where the 2 rectangle parts are touching.
The size in the other axis would be the distance between the 2 other corners of the rectangles (the 2 corners are on the short end, that aren’t touching - the ones closest to the camera in your screenshot)
I’m not entirely sure about how to get the correct rotation of it once you have the right shape. You could try making it the average of the 2 rectangles’ rotations.
Doing all these things should allow you to get a triangle to fill in the space
(Note that this is entirely untested and may not work at all, in which case let me know and I will look at it again when I have more time available)

edit: I just remembered that the wedge parts are always at right angles, so you would need to make 2 wedge parts, one being the mirror of the other one. Then, the positions would need to be offset by some ratio of the difference between the corners closest to the camera
1 Like
This could also help. @EgoMoose does an absolutely brilliant job of breaking math and ideas into information almost anyone can understand:
Articles/3d triangles/3D triangles.md at master · EgoMoose/Articles · GitHub
1 Like
just take the source code of GapFill itself?