Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
In Game Roads - Curvy Generator Prefab?
#1
Lightbulb 
Hello,

I'm using curvy to allow construction of in-game roads over terrains.  I was wondering your suggestion for best approach to the Curvy Generator.  (I'm very comfortable with API access and run-time creation of game object hierarchies.)

Specifically, each road will need to have a curvy generator that is basically the same.  1 road = 1 spline, yes they will be able to connect in many ways.

Should I have a curvy generator prefab that is set up with everything I need (conform path, correct shape extrusion for the roads, etc.) and just GameObject.Instanciate that prefab when I have a spline I want to "turn into" a road?

If that isn't the best way to do it, what would you suggest?

Thanks!
Reply
#2
Hi

The solution you suggest seems good.

About roads intersection, please read this post to know about Curvy's limitations in this field.
https://forum.curvyeditor.com/thread-127...ml#pid4551

Please let me know if anything is unclear.

Have a nice day
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#3
Thanks for the reply and pointing out the road overlap thing - it shouldn't be a problem for my application.

Another approach I thought of was having one generator that could take in a dynamic spline and create the mesh, then copy that mesh at run time (much like the "export to scene" button you have in the inspector graph GUI) and then remove the input spline from the generator (so there are not two meshes). There would certainly be far fewer game objects with that approach.  I expect to have hundreds of splines turned to roads through the course of playing a scenario in the game. Having a generator for each one after it's been placed and finalized doesn't make much sense unless there is something I'm missing?

Thoughts on that?

Thanks again!
Reply
#4
Yes, keeping only the exported meshes is a good idea.
You can leave the input spline in the generator, but disable the generator instead. It will be easier to reactivate this way.
I guess you can use Unity's API to detect when when entering/exiting play mode, and use that to execute the operations we spoke about.
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Morph game object along curve. mikechr2000 5 229 02-04-2025, 09:30 PM
Last Post: _Aka_
  Duplicate Prefab along path rickgplus 1 129 01-23-2025, 10:09 AM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 5 122 10-29-2024, 10:19 AM
Last Post: _Aka_
  I have to refresh generator manualy :( GameDeveloperek4123 4 109 10-07-2024, 05:36 PM
Last Post: _Aka_

Forum Jump: