Bezier Curved Road Generator Plugin

Bezier Curve Road Generator

Install Plugin

“Create curved roads with ease!”

I present to you my recreation of @Hydrolock 's BezCurve Road Builder!

Original Plugin


NOTE

I am by no means a programmer, I don’t code, but I at least have some knowledge of coding. This is my first venture into this type of coding, so if you have any feedback on the script, please let me know! Also I did get permission from the original owner to recreate the plugin.


What does this do?

This allows you to create curved roads that obey the FHWA/AASHTO standards (well, as close as possible while being practical). It does this via the namesake's function, Bezier Curve.

Video Demonstration


How to Use

If you don't want to read, watch the demonstration above!

Preferably before you start, have the following

  1. Have a Model that is named Road
    - The parts inside have to be correctly orientated to the World Orientation

  2. The model has to have a PrimaryPart assigned to it.
    - Preferably the Road part, or what ever is used for the asphalt/concrete and etc

Or just use the one in the starter pack.

Step 1

When pressing on the plugin, it brings down 2 selections.

  1. Create Curved Road - This is the main plugin, probably going to be the most used button

  2. Starter Pack - This will spawn in BezierCurvedRoad StarterPack. Inside it has a sample Road model, the RoadPoints model (contains p1, p2, p3, and p4) and a ReadMe

image

IF THIS IS YOUR FIRST TIME, PLEASE SELECT THE STARTER PACK

Step 2

  1. Ungroup the spawned BezierCurvedRoad StarterPack
    - If your reading this, you can skip and delete the BezierRoadGen README script, unless you want to see the Changelogs or want to read more (who does that)

  2. Ungroup the RoadPoints model (OPTIONAL)
    - This is optional since you can do ALT + LeftClick the parts and drag them around. For easier movement of the parts, ungroup.
    - Inside the RoadPoints model are the control points p1, p2, p3, and p4. The plugin will consider these points as the control points to generate the road with. Move them around to where ever you want them to be.

If you ungrouped the RoadPoints model, and after you placed them around, group it back with the SAME name, ensure that all of the control points are inside. MAX 4 for now

Step 3 (UI)

Press on the plugin again and this time press Create Curved Road option.

Upon pressing,

  1. Select a valid Road Model
    -It will highlight any valid Road Model from the Workspace. If you have a valid road and its not highlighted, this might be the reason why.

After selecting a valid Road Model,

  1. It will now highlight RoadPoints grouping.
    -The parts inside the RoadPoints model will be highlighted, and a line going through the vaid p points. Select any of them.

After selecting a valid RoadPoints grouping, the main UI will appear, giving you a few selections

Starting from the top to bottom

  1. MPH
    - Shows empty at start, but when a road is generated, it will provide a suggested MPH (or KMH when the Switch to KM/H is ticked) on either the tightest curve or if none is detected (or too close to the start/end p1 or p4), the average speed throughout the entire generated road

  2. Segment Length
    - Any value (numbers) you input will be considered as the length per segment. The HIGHER the value, the longer the Road model will be

WARNING

The LOWER the Segment Length value, the more Road models will be generated. This can make the generated road smoother but this can cause a Roblox Studio crash. I am not responsible for any loss of progress of your game. You have been warned.

  1. Curve Strength
    - Any value (numbers) you input will be considered as the strength of the curve. Higher values (>70) means more “curvy” the road generated will be

  2. Generate
    - When pressed, it will generate a road based on the values you inputted above, and the placement of the RoadPoints. It will appear semi-transparent.

ALL roads generated through this plugin will be inside Curve Folder in the Workspace.

image

  1. Done
    - After a road is generated, when pressed, it will finalize the road generated and makes the road generated no longer semi-transparent, and shut down the plugin.

  2. Cancel
    - Cancels out any generated road, and shuts down the plugin.

Optional features

  1. Flip Directions
    - Upon ticking the box, it will regenerate the generated road flip from p1 -> p2 -> p3 -> p4 to p4 -> p3 -> p2 -> p1, Untick the box again and it will revert back.

  2. Switch to KM/H
    - Upon ticking the box, it will switch the displayed MPH to KMH, Untick the box again and it will revert back.


Known Limitations

“My Road lines / Road looks wrong after generating!”

I have said above, that the parts inside the Road Model has to be orientated properly to the World Oritentation. What I mean by this is that the Axes (Axis) has to correspond accordingly. Up/Down is yand Left/Right is x.

“My Lane lines turns into solid road lines!” (Textured lines with spacing)

A part of the limitation of the plugin. Those dashed lines cant be exempted in the code, and I don’t think there is any workaround for this apart from manually adding in those lane lines afterwards.

If you find any more, please contact me!

---

Future Plans

I plan to do a few more things to flesh out the plugin.

  1. Allow tilting to happen at the start/end (p1 and p4)
    - This is very useful for creating sections of roads but needs titling to start immediately or end. I am already trying to make this work

  2. Allow movement of the parts inside the RoadPoints without going through the Explorer or manually moving them outside the plugin
    - This is mainly for quality of life improvements, still thinking of a way to figure this out

  3. Allow generation of more than one RoadPoints at the same
    - A long-term plan for me to implement, really helps with the highways with separate right of ways.

  4. Allow more than 4 Control points
    - Already in the works, will allow for more longer and more defined curves. Really essential.

If you have any more features that you wish to see me implement (atleast to the best of my abilities), please let me know. Contact me at Trellux#trellux or find the MDU social link to the server.

A separate topic dedicated for changelogs will come soon.

Thank you for stopping by!

9 Likes

This is super cool well done! Will you make one for cart ride games in the future?

What do you mean by this? Technically this plugin can work with all models, it just has to be named Road. The highlights currently work to show that it has all of the requirements for the plugin to work properly (and to get the correct results). It can have anything inside, just as long they are orientated properly. So really, it can work for cart ride. I can probably provide a variant without specific FHWA standards so it can be more loose.

Ohh gotcha, I was under the impression that the plugin only creates roads. To clarify I was wondering if I can use this to create rail road tracks like in cart ride games. Is it possible to create something visually similar to this?

image from this post:

It can, but the plugin right now is restricted to the standards of the FHWA, that’s why I named it a Road generator. I can definitely make a variant that removes the hard-coded restrictions so it can make the one in the picture. To be real that is similar to the first version after reworking the plugin, so yea I can make it like that again.

1 Like

Thanks man, that be much appreciated :smiley:

I deployed an emergency update to the plugin, I apparently pushed an update with stuff inside, which broke the plugin.

So if you installed the plugin before you see this post, please update!

Could it be used with train tracks?
Such as these btw.

I believe it can, just that the track parts have to be aligned properly, and that only the track are parts, and orientated properly. The gravel bed can be parts but may get generated wrong.

Overall it can, just some quirks and that this plugin does follow the FHWA standards for roads, so it may not be what your looking for. Look 2 post above your post. I do plan to release a more loose variant for other stuff, or somehow incorporate it in.