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

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?


The solution you suggest seems good.

About roads intersection, please read this post to know about Curvy's limitations in this field.

Please let me know if anything is unclear.

Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
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!
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 will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Error when trying to connect nodes in prefab edit mode Lupos 1 3 05-27-2023, 08:56 PM
Last Post: _Aka_
  Way to get objects script from generator Lupos 10 21 05-26-2023, 09:51 AM
Last Post: _Aka_
  Programming a first-person player/camera to follow a Curvy Spline kenmarold 1 2 05-21-2023, 05:03 PM
Last Post: _Aka_
  Curvy Generator re-initializes on disable? Lupos 4 4 05-19-2023, 03:20 PM
Last Post: _Aka_

Forum Jump: