Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Road Junctions
#1
Hello, I am currently looking into creating some road junctions. 

The junctions' roads do not always connect to the junction with same angle so I can not just put a standard mesh on the junction.
Is there a way to automatically generate a mesh for the junction using Curvy Generator?

Second, I want to have assets spawned at the junction. 
For example, if I create a junction, I want to automatically have some traffic lights spawned at the end of the connecting roads, or add some pedestrian crossings on the roads (...). 
This might differ depending on the amount of roads connecting to the junction or on the junction type. 
Is this possible with the generator? If not, how difficult do you think it is to extend the generator with that feature?

Thank you for your time.
Reply
#2
Hi,

Curvy does not merge the generated meshes when they intersect.
The hardest part to implement this feature is the mesh merging code. Maybe there some open source code out there that does that. Once you have that, plugging it in Curvy should not be hard.

The generator does not have a module to spawn objects in connections. Via the Unity and Curvy APIs you can get the connections on your scene, if needed check that they are connecting one of the splines you are interested in, get the position of the connection, and then spawn objects accordingly.
This can be more or less complex depending on your setup. The more generic you will want that logic to be, the more difficult it will be to implement I think.

Let me know if you need any more help
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.
Reply
#3
Hi I've been working on making a junction mesh at the intersecting splines but with too much success  Sad, it's tricky to say the least. 
What I've basically done is get all the points along the spline using InterpolateByDistance. Then for each point I  project another 2 points ( 90 degrees to the  left & right ) & these points make up part of the mesh. See below :
  As you can see the meshes just overlap each other at the moment which is not really ideal, what needs to happen where the meshes overlap they should not be drawn as seperate meshes but as one large intersection mesh & this is what I'm struggling with.  
Looking at the screenshot you could say that the outer points of spline 3 which are inside of spline 1  should not be part of any mesh (this can be determind by checking the distance of said points against some of the points on spline 1, if they are less than 0.5 of the road width then they are overlapping spline 1).

    I thought I'd share my work even though it's far from complete in case someone who's a lot cleverer than me might be able to suggest how we might achieve making this junction mesh.
BTW if anyone does know of any code that could do this I've be gratefull to hear about it. 





 [Image: 31GyaKW.jpg]
Reply
#4
Hi
Thanks for sharing your work. I am interested in any of your future updates.
Make sure that you have looked for existing solutions on the internet. This problems seems to me so common that it would surprise me that no paper/implementation of a solution exists already.
Thanks and have 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.
Reply
#5
Hi, I have looked many times on the net but I cant for the life of me find anything. I've put this part of my project on hold for the moment and I've moved on but I will be coming back to it.
Regards
Reply
#6
Hi,

Here are some of the keywords that could help you in the search of a solution to combine multiple meshes in one:
- Mesh boolean operations
- CSG Constructive solid geometry
Those are basically techniques to combine and subtract meshes with/from each other

Here is a Unity asset I found that has CSG in it
https://www.youtube.com/watch?v=KjfMWICV-3U

Maybe there are other assets like this one in the "modeling" category of the asset store
https://assetstore.unity.com/tools/modeling

If you can't find a ready made unity asset, then maybe looking for a c# implementation of boolean operations will yield satisfying results. Otherwise, you might have to save your meshes into mesh files, use an external application (which removes the constraint of finding a solution implemented with c#) to do the combining, then import the result back into unity.

I hope this helps
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#7
(11-02-2019, 01:33 PM)_Aka_ Wrote: Hi,

Here are some of the keywords that could help you in the search of a solution to combine multiple meshes in one:
- Mesh boolean operations
- CSG Constructive solid geometry
Those are basically techniques to combine and subtract meshes with/from each other

Here is a Unity asset I found that has CSG in it
https://www.youtube.com/watch?v=KjfMWICV-3U

Maybe there are other assets like this one in the "modeling" category of the asset store
https://assetstore.unity.com/tools/modeling

If you can't find a ready made unity asset, then maybe looking for a c# implementation of boolean operations will yield satisfying results. Otherwise, you might have to save your meshes into mesh files, use an external application (which removes the constraint of finding a solution implemented with c#) to do the combining, then import the result back into unity.

I hope this helps

Thanks for the pointers, I'll certainly look into them.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is it possible to create a road texture at runtime? artsung 1 4 01-30-2024, 09:30 AM
Last Post: _Aka_
  Multiple Splines and Generators Performantly for Road System drock 1 6 07-17-2023, 10:31 AM
Last Post: _Aka_
  How can I remove one segment of the road that I made by spline? Chanon 3 7 09-14-2022, 04:44 PM
Last Post: _Aka_
  Performance lag for Endless Road generation User2200 5 1,657 04-08-2021, 08:33 AM
Last Post: _Aka_

Forum Jump: