Bezier Curve Road Generator Version 0.5
“Create curved roads with ease!”
Changelog
https://devforum.roblox.com/t/bezier-curved-road-generator-update-log
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?
Preparations
UPDATED 02/09/2025
If you don't want to read, watch the demonstration below!!
Preferably before you start, have the following
-
Have a Model that is named
Road
- The parts inside have to be correctly orientated to the World Orientation -
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 -
Ensure that ALL of the parts of the model follow the following axis orientations
X is the LENGTH of the Road
Y is the HEIGHT of the Road
Z is the WIDTH of the Road
Step 1
When pressing on the plugin, it brings down 2 selections.
-
Create Curved Road
- This is the main plugin, probably going to be the most used button -
Starter Pack
- This will spawn inBezierCurvedRoad StarterPack
. It includes 4 sample roads, all namedRoad
, theRoadPoints
model (containsp1
,p2
,p3
, andp4
) and a ReadMe
Step 2
-
Ungroup the spawned
BezierCurvedRoad StarterPack
- If your reading this, you can skip and delete theBezierRoadGen README
script, unless you want to see the Changelogs or want to read more (who does that) -
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 theRoadPoints
model are the control pointsp1
,p2
,p3
, andp4
. 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) UPDATED
Press on the plugin again and this time press Create Curved Road
option.
Upon pressing,
- Select a valid
Road
Model
-It will highlight any validRoad
Model from theWorkspace
. If you have a valid road and its not highlighted, this might be the reason why.
After selecting a valid Road
Model,
- It will now highlight
RoadPoints
grouping.
-The parts inside theRoadPoints
model will be highlighted, and a line going through the vaidp
points. Select any of them.
After selecting a valid RoadPoints
grouping, the main UI will appear, giving you a few selections
-
Segment Length
- Any value inputted will be treated as the standard length that will be used in the road generation. The HIGHER the value, the longer theRoad
model will be generated.
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.
-
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 -
Dynamic Curve Strengh
- If ticked, input a Speed in MPH, the value inputted will be considered as the baseline speed for the curve, and the road generation will adjust accordingly to the value
Banking
-
Extend To 0
- If ticked, the road generation will generate beyond thep4
, with a goal to smooth out the banking angle to 0. Length will vary depending on the last generated bank angle.
Lane Generation
-
# of Lanes
- Any value inputted will be considered as the amount of lanes that will be generated. There is a Suggest Lane value just above depicting a suitable amount of lanes, based on the default 15 stud width per lane -
Stripe Length
- Any value inputted will be considered as the length of the lane stripe -
Width per lane
- Any value inputted will be considered as the width of the lanes -
Lane Stripe Spacing
- Any value inputted will be considered as the spacing of the lane stripes. -
Generate
- When pressed, it will generate a road based on the values you inputted above, and the placement of theRoadPoints
. It will appear semi-transparent.
-
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. -
Cancel
- Cancels out any generated road, and shuts down the plugin.
Optional features
-
Flip Directions
- Upon ticking the box, it will regenerate the generated road flip fromp1 -> p2 -> p3 -> p4
top4 -> p3 -> p2 -> p1
, Untick the box again and it will revert back. -
MPH
- Shows empty at start, but when a road is generated, it will provide a suggested MPH (or KMH when theSwitch to KM/H
is ticked) on either the tightest curve or if none is detected (or too close to the start/endp1
orp4
), the average speed throughout the entire generated road -
Switch to KM/H
- Upon ticking the box, it will switch the displayedMPH
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 orientation said above.
“The compatible road models are not being highlighted!”
Theres some problems with this, even I face it at times, I am working on it, but it will take some time.
If you find any more, please contact me!
---Future Plans (Updated)
I plan to do a few more things to flesh out the plugin.
-
Allow tilting to happen at the start/end (
p1 and p4
)
- Already underway, the code already supports this, but it is not working correctly. Maybe in the next update! -
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. Several branches of the code attempted to implement this, nothing worked. -
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. -
Allow more than 4 Control points
- Already in the works, already laid the foundation work for it. In the most unstable build, it works! so see it soon!
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.