Open-Source-Transport / roblox-path-plugin

GNU General Public License v3.0
5 stars 2 forks source link

Ability to create multiple parallel paths at once with a single curve #6

Open tylerfreemann opened 6 months ago

tylerfreemann commented 6 months ago

Another quality of life thing, allow lanes to be added through the plugin, instead of having the create a new model every time. This will also allow us to "Cant" individual lanes.

anthony0br commented 6 months ago

Good idea. You’d probably need to work out normals of the segment lines (i.e. cross product of the look and up vector of each segment line) and translate in the direction of average normal of all lines connecting into a node. We’d need some options like Lane spacing, alignment, etc.

arandomollie commented 6 months ago

No need to translate entire curve - probably easier to compute centreline curve, then translate individual segments as needed and gap fill

anthony0br commented 6 months ago

Of course! I’m basically reinventing what ResizeAlign does, oops. I wonder if we could investigate custom alignment implementation for better performance or readability though - effectively just use the cross product of look and up vector for direction, translate by distance to the edge then use the magnitude of the difference of the two nodes to work out the length of the outer edge.

Edit: ResizeAlign uses a method which uses the dot product to find the shortest distance between two rays, which is pretty nice and probably quite fast, although has a raycasting method to find targets which we definitely want to avoid for performance and reliability (since the previous and next segment parts are known!). I think our current code avoids this though.

anthony0br commented 6 months ago

Happy for this to be implemented with this method for now though