-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generating RoadPoints from existing Curve3D? #206
Comments
Hey there! I'd be happy to help. But to start with making sure I understand the goal here, the questions:
Do you mean, creating one overall curve that represents the entire road network? There's no single solution that could really work for this, as native curves are (by definition) continuous without breaks and non branching. In contrast, the Road Generator lets you connect and disconnect road segments, join them up to prefab pieces (e.g. intersections) and so forth. You could, however, write a function that tries to generates a curve for one continuous stretch of road at a time, ie a non broken sequence of RoadPoints. My main question is: what is the use case for this? What are you trying to do with this single continuous stretch of road? Is this to add details along the side of the road or something like this? And, is this for a procedural in-game generation use case, or more about e.g. placing curves to decorate items along the road in the Godot editor? I'm asking these questions so I can help better advise.
So you mean going from a hand-authored curve and then automatically creating roads from that? Again, I'd be curious to hear about the workflow you are trying to have where you'd start with such curves. Are they coming from another software, or is there a reason it's not convenient enough to just draw the road curves directly with the Road Generator menu? But nonetheless, while we don't have built in functions this, your code snippet is somewhat similar to what we are doing in Wheel Steal Game. We add a series of RoadPoints with some distance between each one, placement and orientation is sampled along the curve to create more organic feeling procedurally generated roads.
I think this is the same as the first question right? Let me know if not. Hope this helps! |
I use generated content and use curve / curves as a baseline. Currently npc-vehicles use center curve to take direction on the road. Other approach might be more scalable and easier to use if intersections or other roads are added - maybe some day. Principle is pretty much the same - to take direction to some point and go towards. I use rigid bodies with physics, and precise point is not needed - just a guideline. Terrain data also uses road-curve. I generate road, terrain and assets before game starts, so there is currently no generating after game starts. I continued code a bit and now it take edge_(RFC) points from given container point-ranges. I just really don get, how I should rotate / transform taken path and its curvepoints to generate proper curve.
|
tool script to make curve from rp:s - far from perfect. Requires that edge curves are parsed by rg.
|
edit 2 : I dont know what happened, maybe the update from .51->.52 version changed it, but now the imported curve can be edited directly! (godot4.3). After importing scene should be saved, closed and opened again. The code below made is not a rock solid good solution, but might helps in some cases. The remaining question ; how to export just curves from the road-generator? Not just separate rp-parts?
Is it possible to generate proper RoadGenerator road from existing Curve3D?
Another question - how to get full continous curve from road-generator created road?
I can get roadpoint-curves, but those are alla separate curves and I dont know how to create proper curve from those. Only useful I can get is the transforms.origin point and create curve from those, but losss of curve information is enormous. Those transformations are a bit too complicated me to
Code (Godot 4.3, add it tool-script, give valid curve and chunk size to parse):
edit 3 - below (mostly) working code to make road from plain curve
The text was updated successfully, but these errors were encountered: