Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

World Building EasyRoads3D v3 - the upcoming new road system

Discussion in 'Tools In Progress' started by raoul, Feb 19, 2014.

  1. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi tomobiki,

    The first thing to check is to see if this is a result of the generated data. Can you switch back to Edit Mode and enable visibility of the white surfaces that represent a visualization of how the terrain will be adjusted:

    General Settings > Scene Settings > Hide White Surfaces

    Do you see the same shape in the white surfaces?

    In that case, I see only two blue marker handles near the yellow I Connector. What is the setup of this road section, marker Indent values? Are there indeed no road markers in the area where these white surfaces have an irregular shape?

    If the shape of the white surfaces look correct, does this terrain issue indeed only happen in this specific area of the terrain? What happens when moving the I Connector 50 to 100 units sideways preserving a similar road shape in that specific section?

    In general, currently there is no code that will adapt terrain deformation based on how straight or curvy a road is. It is possible to auto adjust terrain deformation based on the distance to the terrain and the terrain profile:

    General Settings > Scene Settings > Terrain Cell Angle Threshold

    But I do not think that is involved here.

    Also, the second screenshot is road type related, if what happens is a result of specific settings, it will be the actual road object settings, marker settings.

    Thanks,
    Raoul
     
  2. sumioka

    sumioka

    Joined:
    Sep 26, 2018
    Posts:
    8
    I am using 3.3b7.
    Lane Direction Marking does not seem to work with URP. The mesh is not generated. Is this a problem in my environment?
     
  3. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi sumioka,

    URP is more material related. The example decal material uses the ER Road Decal shader which is also part of the URP material / shader package.

    Are you using the provided examples or your own materials? And which packages do you have imported? The v3.3 beta does not include URP support package. The URP support package available in v3.2.1 package can be used for that.

    Are the objects actually generated? This can also be checked in the hierarchy, these are child objects of the actual road object. In that case, can you select one of these objects and check in the Inspector if a mesh is generated?

    If the objects are not generated in the hierarchy, what is the setup? Do your road types have these lane direction marking decals setup in General settings > Road Types in a similar way as for the road type in the v3.3 beta demo scene?

    Thanks,
    Raoul
     
  4. sumioka

    sumioka

    Joined:
    Sep 26, 2018
    Posts:
    8
    The material uses the ER RODECAL shader.
    The URP support package provided in the v3.2.1 package is applied.
    /EasyRoads3D/SRP Support Package/URP_7_3_1.unityPackage

    The object is generated, but the mesh is not.
    Attached is a reference image.


    These lane direction marking decals are set in General Settings > Road Type.
    When I try with a non-URP built-in project, the object mesh is generated.
    Therefore, I believe this is a URP-only phenomenon.
    Thanks.
    URP_directDecal_notworking.png
     
  5. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722

    Hi sumioka,

    A similar situation can be reproduced in a new scene with a new road network object when "Active" for "Generate Lane Data" in "General Settings > AI Traffic" is switched off.

    In order to generate these lane direction markings, lane data is required.

    Also, is this road type one of the provided v3.3 beta road types or did you create it? Is lane info set for this road type in General Settings > Road Types?

    Does that solve the problem?

    Thanks,
    Raoul
     
  6. tomobiki

    tomobiki

    Joined:
    Sep 27, 2020
    Posts:
    65
    Hi, thanks for your help and your explanations.
    I didn't know the white surfaces feature: actually it's very useful!

    I solved the problem changing the "indent" parameter for the road type and now it's ok, as you can see from the screenshot.

    I'll do the other tries you told me, but I think that this already solves quite well the issue.
    Thanks!

    upload_2022-7-8_16-30-47.png
     
    raoul likes this.
  7. Bmco

    Bmco

    Joined:
    Mar 11, 2020
    Posts:
    54
    Hello, I've been using the asset for runtime only (so far with great success). I use version 3.2.1f4.

    I would like to change the roadtype property at runtime. However, if I call erRoad.GetRoadType(). This returns null. If I call erRoad.SetRoadType(myRoadType), the boolean returns false and the road is not updated. If I call erRoad.SetMaterial(myMaterial), that works for my use case, but I'd prefer using pre-defined roadTypes. Is there some other/better way to update roadTypes at runtime? Do I have to add roadTypes to the roadNetwork first?
     
  8. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi tomobiki,

    Glad to hear you got that fixed.

    Checking these white surfaces is the first thing to do when the terrain updated in a different way than expected.

    It gives a more accurate representation than the transparent "Highlight" surfaces that can also be activated in Scene Settings and with Ctrl + Space.

    Thanks,
    Raoul
     
  9. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hello @Bmco,

    What is the exact workflow?

    Are these road objects created at runtime? In that case, is the road network object and the road created at runtime?

    Or is road network created in the Unity editor and are all road types already setup in the Unity editor?

    public bool SetRoadType(ERRoadType roadType)

    This can be used to update the road type for a road object. An indeed the road type must exist in the road network. That is why I asked about your workflow.

    Thanks,
    Raoul
     
  10. sumioka

    sumioka

    Joined:
    Sep 26, 2018
    Posts:
    8
    Thank you! It worked.
    It was because I had not set up AI Traffic.

    ER_complateDirectDecalURP.png
     
    raoul likes this.
  11. Bmco

    Bmco

    Joined:
    Mar 11, 2020
    Posts:
    54
    Yes. Everything is created at runtime (Network, RoadTypes and Roads)
     
  12. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hello Bmco,

    Can you post the code used to create the road types, the road objects and how the road type is changed?

    It is recommended to actually work with a road network object that is already set in the Unity editor with road types and side objects available.

    This way the road type of a road object can be changed like this:

    Code (csharp):
    1. ERRoadNetwork roadNetwork = new ERRoadNetwork();
    2. ERRoadType roadType = roadNetwork.GetRoadTypeByName("road type name");
    3. roadObject.SetRoadType(roadType);
    Thanks,
    Raoul
     
  13. jaydnwlsn

    jaydnwlsn

    Joined:
    May 28, 2019
    Posts:
    4
    This was back in Jan 2020. Did road auto-creation end up being implemented?
     
  14. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi jaydnwlsn,

    As mentioned in that specific post, this type of features is "next".

    Automatic side object creation is meanwhile implemented in v3.2.1

    The main focus at the moment is on the actual road network options, more complex crossing types etc. This is complex, it is still in beta v3.3, not far from being available in the Asset Store download.

    After that features like automatic road network creation will be added. This and other features is worked on in the background, if you have specific feature requests for this, please let us know.

    Thanks,
    Raoul
     
    jaydnwlsn likes this.
  15. tomobiki

    tomobiki

    Joined:
    Sep 27, 2020
    Posts:
    65
    Hi,
    a question about integration with World Streamer 2.
    Some time ago I asked to you an help about the API script ERRoadNetwork class, CenterPivotPoints() that can be used to manage the position of the network parts (roads and intersections) that otherwise are all set at 0,0,0 to make the road network compatible with World Streamer 2.

    You replied with this script:

    Code (csharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using EasyRoads3Dv3;
    4.
    5. public class ERAPIEditor : Editor {
    6.
    7. [MenuItem("GameObject/3D Object/EasyRoads3D/Center Pivot Points")]
    8. public static void CenterPivotPoints()
    9. {
    10. ERRoadNetwork roadNetwork = new ERRoadNetwork();
    11. roadNetwork.CenterPivotPoints();
    12.
    13. Debug.Log("Process completed");
    14. }
    15.
    16. }

    Do you know if this script is still valid with the actual version of EasyRoads? I think so, but I prefer to ask you before doing something wrong and mess things up.
    Thank you very much.
     
  16. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi tomobiki,

    Yes, roadNetwork.CenterPivotPoints(); is documented API code in the ERRoadNetwork class. Documented API code should also work in new releases.

    Please use this after work on the road network is completed.

    Let me know if you experience issues with this.

    Thanks,
    Raoul
     
  17. Ward101

    Ward101

    Joined:
    Mar 22, 2016
    Posts:
    52
    Hi, Raoul! Question on SideObjects.
    I want to create SideObjects (like this turn sign). Below are my settings.
    I do not create as Default active ..., as I activatemanually per Marker.
    The problem I´m having, is that I always get two. One at the beginning (of the marker pos), one at the end (plus o minus the offsets. I want to create ONLY ONE (at marker position +/- the offset). Is it possible?

    upload_2022-7-13_13-55-3.png

    upload_2022-7-13_13-56-15.png
     
  18. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi Ward101,

    By default the "Distance between Objects" value is recalculated based on the total length, this is represented by the "Average by Road Length" toggle below "istance between Objects". Could you try switching this off and use a large value for "Distance between Objects".

    Does that result in what you are looking for?

    Thanks,
    Raoul
     
  19. jaydnwlsn

    jaydnwlsn

    Joined:
    May 28, 2019
    Posts:
    4
    Hi Raoul, thanks for replying. My apologies if my inquiry sounded expectant :)

    Automatic road network generation will be huge! Can't wait! Some features that come to mind:

    - runtime functionality
    - multithreading
    - awareness of terrain layers/textures
    - a point of interest system per road type for "aiming" nodes with said POI's having a scalable amount and influence factor
    - various pathfinding techniques for performance/accuracy scalability
    - expansion of side objects to allow some randomisation and frequency options every min-max x units
    - optional looping

    A few parameters that would be great:
    - allowable road types per intersection (a+b, b+c, c+a, etc)
    - intersection frequency per road type
    - weighting per road type
    - min-max turn & scaling angles per road type
    - min-max distance/height for tunnel & bridge generation
    - road/object preferences per terrain texture

    The more variables the editor has access to for each situation, and the more granular those variables are, the better.
     
  20. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi jaydnwlsn,

    This will work at runtime and in general this is in line what we have in mind. But I will add all these requests to the notes as a reminder.

    But what you request also shows the complexity of this feature, automatic road network creation, regardless the actual road network mesh generation which is step 1 :)

    Thanks,
    Raoul
     
    jaydnwlsn likes this.
  21. Ward101

    Ward101

    Joined:
    Mar 22, 2016
    Posts:
    52
    Hi! I think it worked. At least on a synthetic example.
    I will test on my real scene and will let you know!

    Thanks!
    Eduardo
     
    raoul likes this.
  22. schaefsky

    schaefsky

    Joined:
    Aug 11, 2013
    Posts:
    90
    Hi, is there a way to create intersections in code (editor) without using intersection prefabs?
     
  23. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi schaefsky,

    Do you mean at runtime or add intersections to the scene in the editor through code? Because built-in intersection prefabs stored in the project folder are initially generated through code from inside the editor.

    In v3.2 adding intersections to the scene does require intersection prefabs.

    The v3.3 beta Flex Connector can be add to the scene through code, no prefabs involved. Available in the ERRoad class:

    public ERConnection InsertFlexConnector(Vector3 position, ERRoad road2, int markerIndex)

    The Flex Connector will be inserted at the passed position. Road2 will be connected as well at the passed marker index.

    Thanks,
    Raoul
     
    schaefsky likes this.
  24. schaefsky

    schaefsky

    Joined:
    Aug 11, 2013
    Posts:
    90
    Hi, thanks, I am on 3.3, seems the API reference is still in 3.2?

    I am working in the editor through code.

    So, markerIndex is the markerIndex of the passed in road2, correct?
    I can not really get it to work:
    ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <31c0f51ac5a24a22ba784db24f4ba023>:0)
    EasyRoads3Dv3.ERCrossings.OCDCQDCOCD () (at <2840aca9d8774b7088d4c2233facbaef>:0)
    EasyRoads3Dv3Editor.DOQQDSQQDQODD.OnEnable () (at <7ad4c0f8f3af455d92c67beec39f5372>:0)

    I am not sure if I am using it correctly though. What I want to do is this:
    I have a bunch of nodes (Vector3) which make up a small town road network. Some of these nodes are intersections, others are just "single" nodes along a road.
    With the ProceduralWorlds GeNa road splines, I can call AddNode (basically Vector3) for all my nodes in no particualr order, and then AddCurve(node1, node2) to connect the "neighbors" where appropriate. This will build roads and intersections where necessary.
    How can I "translate" that to EasyRoads 3.3?
     
  25. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722

    Hi schaefsky,

    The Flex Connector is v3.3 so InsertFlexConnector() will only work in the v3.3 beta.

    Yes, markerIndex refers to the marker of the road2 that should be attached to road1 at the passed position.

    I just tested that. It works well when this is the first or last marker of road2. The end result will be a Flex Connector with 3 road objects attached.

    I also tested passing another marker index. In that case road2 should be split at markerIndex and the end result should be a Flex Connector with 4 road objects attached. This does not work well yet and will be fixed.

    I also added some code checking for a valid passed markerIndex for road2. Could this perhaps be related to the error in your code?

    After a Flex Connector is created more road objects can be attached, ERRoad class:

    public bool ConnectToStart(ERConnection connectionObject)
    public bool ConnectToEnd(ERConnection connectionObject)

    connectionObject is the Flex Connector.

    The only limitation here at the moment is that when different road types are involved, two "secondary" road objects (road objects that will be attached on the Flex Connector to the main road type) cannot be next to each other.

    Thanks,
    Raoul
     
    schaefsky likes this.
  26. schaefsky

    schaefsky

    Joined:
    Aug 11, 2013
    Posts:
    90
    Hi Raoul,
    I tested it again and the issue is indeed that the roads have to be set up correctly. I think it throws an error when you try to insert a flex connector at the end of a road (so not road2). Which in a way makes sense.
    But if I understand correctly I basicaly have to analyse my roadnodes to build something like the longest connected road, then insert flexconnectors to create the initial intersections, and then connect the remaining roads to these intersections (if applicable)?
    If yes that means this is a rather involved workflow compared to the GeNa road system where I can just add node positions, add the connections between these nodes, and the road network is done.
    Of course EasyRoads has a lot of other advantages over GeNa when it comes to buidling roads, but maybe a simplified workflow to create a roadnetwork could be something for you to look at?

    On another note, I noticed that I have to move the flex connectors (both created in code or by hand) a little bit after creation for them to "update", so adjust the roads connected to become smooth.
    Also they seem quite a bit buggy when you connect roads together, and then delete one of the roads again.
    I know it is beta, just FYI.
     
  27. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi schaefsky,

    Yes, that is correct. The idea of the current InsertFlexConnector() function is to split road1 in two road objects, Insert a Flex Connector and also attach road2. So the passed position should be inside road1, not at the start or end.

    This matches the same behaviour when doing this directly in the Unity editor. When moving the mouse over a road section (with NO road object selected) a new road object can only be extruded inside the road object, not at the start or end. But the start and end of a road object can snap to a Flex Connector.

    I think it is a fairly simple workflow to create road networks through code as well. But I guess it depends on the data format of the road objects that you have. I would think that in order to create connections between nodes, you must know these nodes, to which road objects they belong.

    With the current API options, if you have road A and B and C. Is this what you are looking for?

    In the ERRoadNetwork class:

    // Connects two road objects at the nearest markers.
    public ERRoad ConnectRoads(ERRoad road1, ERRoad road2)

    or

    public ERRoad ConnectRoads(ERRoad road1, int markerIndex1, ERRoad road2, int markerIndex2)

    So this can be used to connect road A and B, resulting in road D

    Followed by:

    public ERConnection InsertFlexConnector(Vector3 position, ERRoad road2, int markerIndex)

    to attach road C to D. The original end marker position of road A can be passed as the position.

    This is is just to show how this could be done in the current version if I understand the situation on your end correctly. It will take only two lines of code.

    But I will make a note to also add a function that will connect three road objects using a Flex Connector. It seems that is ideally what you are looking for?

    The scripting API is mainly expanded by user requests so feedback is welcome and very much appreciated.

    Yes, I noticed the same when testing this earlier today. I already made a note to make sure all objects are fully rebuild.

    I will check what happens with Flex Connectors after deleting road objects, thank you for reporting that.

    Thanks,
    Raoul
     
  28. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    308
    I have an issue with a Side Object not getting the specified material on the mirrored side when I use the Dual Sided option. Even if press Refresh Side Object on the Scene View Operation tab, the material is not fetched.

    Seems like if I disable and re-enable any Side Object, the material is missing regardless until I refresh it. I have already used the Update Active Scene Instances button.

    EDIT: in the end the problem seems to have sorted out itself after I changed the an entirely different material to make some tests.

    A bunch more things that I write as I discover them.
    - Saving UV points for a Shape in the Shape Editor doesn't always work, sometimes these are not saved at all.
    - Adding Markers with I will actually add two markers.
    - It's very easy to add or delete Markers of a selected Road when renaming the Road itself. :)

    Schermata 2022-07-21 alle 19.13.31.png
     
    Last edited: Jul 21, 2022
  29. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hello DanjelRicci,

    Glad to hear you managed to resolve the material issue. Dual Sided side objects essentially are based on the exact same side object data with regard to materials. So we are interested to see what initially happened, please let us know if you run into this again.

    How are you testing this? Changing UV points in the UV Editor window will instantly update UV data for the side object. Pressing the "Apply" button in the main Shape Editor window will instantly update scene instances of this side object even with the UV Editor still open. This works fine on our end. Does this happen after specific steps?

    What I did notice was that the Apply button remains disabled after pressing it, Changing UV positions in the UV Editor again afterwards does not enable it. A change in the Shape Editor window itself is required for this. This will be fixed in the next update.

    Adding markers is one of the key processes of the tool. It is unknown that two markers are added on a single Shift + Click. What are the exact steps to reproduce this?

    Add road Markers is done with Shift + Click when the focus is on the Scene View window, in what way is this triggered on your end when renaming the name of a road object?

    Remove markers is Shift + R with the focus on the Scene View window. This should not be triggered when the focus is on the Inspector window for changing the road object name. I just tested this. Is that actually the case on your end?

    Thank you for the feedback, much appreciated!

    Raoul
     
  30. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    308
    Hi Raoul and thanks for the reply!
    If it is on any help, I'm on Mac M1, Unity 2020.3.36f (Intel), EasyRoads v3.2.1f4.

    Will do! It was an odd problem but didn't happen again so far. Not sure what could have triggered it.

    After a bunch more tests this seems to consistently not work for me if the Shape material uses a non-square texture (in this case it is 1024x512). When I close and reopen the UV Editor, the UV points are not where I left them and partially over the end of the texture (pic below). Everything works regularly when the material uses a square texture.

    Schermata 2022-07-22 alle 02.45.56.png

    I just press i while having a Road selected and it creates two Markers in the same spot right away, and it plays the system alert/ding sound like if I misclicked something. This happens all the times even with a newly created Road. :(

    My bad, Markers are not deleted or created normally, but when writing into any input field, i still works and creates a Marker under the mouse even if is way out of the Scene view, like in the screen below. Ironically, in this case only one marker is created...

    In this pic, the white line is vaguely where the Road was originally, then I wrote where the red circle is ("Highway sound barri"...), and a Marker was created behind there when I pressed i, you can see the Road mesh going in that direction.
    EDIT: It actually happened also as soon as I wrote "Hi" from "Highway" earlier on- I was just doing that again with "barrier" to replicate it for the screenshot.
    Schermata 2022-07-22 alle 02.36.18.png

    ---------

    Anyways thanks for this plugin- it's incredible. I bought this so many years ago but it felt unstable and overkill and ended up never using it. I'm dusting it off now again and feels much more solid, it will probably be critical for speeding up my workflow. Any ETA about v3.3? I'm really looking forward to integrated motorway ramps since I'll make extensive use of these.
     
    Last edited: Jul 22, 2022
  31. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi DanjelRicci,

    Thank you for the further feedback.

    I see what you mean. To reproduce, use a non square texture, set UV coordinates, close the UV Editor window and reopen it.

    In the most recent version there are actually changes regarding how non square textures are handled in the UV Editor window. And the same UV Editor window is used in different situations, not only for the Shape Editor window. It seems these changes are not yet updated for the Shape Editor window. This will be fixed.

    The i key is used to insert road markers between existing markers. It does not create two markers on our end, and this situation has not been reported before. Perhaps it is a Mac related issue. I will see what can be done here.

    Good to know that markers are not deleted. The i key behavior sounds similar to what is discussed above.

    It is strange, all these events where road markers are added, inserted, removed are Scene View related. The focus must be on the Scene View window. When typing in Inspector window fields, the focus obviously is on the Inspector window.

    Something to perhaps test, do you have a custom Unity editor setup? In that case, can you duplicate the project and in the duplicated project reset the Unity editor to one of the default layout options? Does that make a difference?

    Glad to hear you like the tool. I belief early versions were quite stable too but it all depends on what you want to create. Development has been a long process, when it comes to road networks, there are so many different situations.

    We try to keep the workflow simple for basic usage, yet provide a framework for more complex road networks for which a learning curve is involved regarding how to achieve specific situations.

    V3.3 also is a long process. The v3.3 Flex Connector seems to get fairly stable. It will soon be part as a separate package of the Asset Store download to get more feedback. Once feedback is good it will be released.

    After that the focus will be on integrated dynamic motorway ramps for v3.3.x. Prototypes for that are ready but need to be further integrated. All that will also be released in betas which hopefully will not take too long.

    Thanks,
    Raoul
     
  32. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    308
    Thanks for following up and for the info on v3.3 For now I will use custom models for ramps.

    Seems like the issue doesn't happen if I use the Unity Default editor layout. I use a custom layout but it doesn't have anything special going on, I just moved around the default windows (Hierarchy, Project, Inspector, Console, etc etc). I don't have custom editor windows or other things constantly running in-editor.

    Another issue I just encountered: Roads coming out of a Connection don't immediately follow the Angle Threshold rules. The road in the picture below is set to Resolution 50, Angle Threshold 1. As you can see, the first few meters on the left don't generate the extra segmentation. If I lower the Resolution value it looks smoother, but then the whole road uses many more triangles which is not ideal in my case.

    Schermata 2022-07-22 alle 16.52.08.png

    In general Roads seem to easily misbehave when coming out of Connections, like this weird slope below. This one is less of a problem though, it's avoidable by using smoother slopes out of a Connection.

    Schermata 2022-07-22 alle 17.01.21.png
     
  33. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    That is interesting. If you want to debug this further perhaps you can send us a full new empty project, this will include your editor setup. Our email is in the readme file in the EasyRoads3D root directory.

    Just as a test you could also import the EasyRoads3D Pro package in this project and see if indeed the same happens when changing road object names.

    I see what you mean, the Angle Threshold starts to be respected at a distance equal to the general "Resolution" value when the road is attached to a connection object. When this is a larger Resolution value the results can be improved by inserting additional marker control points.

    But this will be changed, so when the Angle Threshold option is used this will also affect the road shape near connections.

    I don't think that is generally the case. It is at least not a known issue in the current versions. Does this also happen with the provided dynamic and custom connection prefabs? Or are custom "Resolution" and "Angle Threshold" values involved here as well?

    Otherwise, if you want you can send the model used for the ramp in the image so we can test it.

    What I do see is that the two connections on one side are close to each other pointing almost in the same direction. This will probably work well when the two connected road objects are exactly at the same height. When that is not the case, there will likely be terrain deformation issues when adjusting the terrain to the road shapes because there are not enough terrain points available in between the two parallel road objects near the connection.

    Thanks,
    Raoul
     
  34. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    308
    One more issue I'd like to report... This time I'm attempting to create a dynamic roundabout. At some point completely at random, when trying to move Connections, the editor starts spamming this error. When this happens, Connections reset to an even position, the blue and red markers no longer match with the existing Connections, and the roundabout mesh is not updated. I don't think I'm doing anything wrong, I'm just trying to create some connections and place them at the desired angle.

    ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <695d1cc93cca45069c528c15c9fdd749>:0)
    EasyRoads3Dv3.ERSideWalkVecs.OQDQQCQCOD (EasyRoads3Dv3.ERRoundabouts scr, UnityEngine.Vector3[] normals) (at <927f132ec52d421997b8df4ee1fbe906>:0)
    EasyRoads3Dv3.ERRoundabouts.ODQCODDDCQ () (at <927f132ec52d421997b8df4ee1fbe906>:0)
    EasyRoads3Dv3Editor.OCDCDQQOQO.OnInspectorGUI () (at <2abcfac651c44e0da28b4fdb5c6790e7>:0)
    UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Editor/Inspector/InspectorElement.cs:546)
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
     
  35. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    When changing roundabouts the roundabout radius, the number of connections and the connection widths are important.

    Red boundarries will be visible for the selected connection showing how far this connection can be moved towards the neighbour connections.

    When the position is changed in a way that the selected connection will overlap other connections there will be a warning in the console "connection x cannot be updated, move the position forward", or backwards depending on the situation.

    I just tested this, at no point did I get errors like in your post. Which settings do you use? Roundabout radius, resolution, connection / road type widths and connection positions?

    [Edit] The Left and Right Rounding Radius values are actually also important.

    Hopefully that way the error can be reproduced.

    Thanks,
    Raoul
     
    Last edited: Jul 22, 2022
  36. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    308
    I'm starting to think the plugin just doesn't like OSX because I'm not doing anything special, all the issues I mentioned above just happen while using the plugin normally, even in a brand new project or in the demo project from the Asset Store. Sorry to be the bearer of bad news but I swear I'm just trying to use the plugin according to the docs and the tutorials (I watched every single one on the official Youtube channel).

    For the roundabout issue, I had created a new roundabout, specified a large radius (50), and then started creating Connections. At some point while moving the connections around, the error above just triggered like it failed to detect when the Connection couldn't be moved. Every time I get that error the roundabout gets "corrupted" and I have to create it from scratch because nothing seems to stop the error from triggering. Also I got the same error when I tried to increase the radius of a roundabout I created earlier on, which is odd because making it wider should leave more space for Connections and shouldn't cause any problem. All Connection values I used where the default ones.
    EDIT: also I think we need a way to define the tiling of the roundabout road texture, it looks too stretched.

    Anyways, I seem I can't get Lightmap to bake on Dynamic Connections. If select a Connection in the scene, the renderer has an alert saying "Mesh with point, strip or line topology is not supported by light mapping". If I open the Connection prefab, that error is not shown in the Renderer of the base object, but it is in the renderer of the child "surface" object.
    EDIT: Seems like Dynamic Connections lose the Static setting from the prefab when they are created in scene, that seems the reason for why they aren't baked. I can set them Static manually from inside Road Network/Connection Objects and they get baked, but this doesn't look like the intended workflow.

    Shaded view VS Baked Lightmap view:
    lightmaps.jpg
     
    Last edited: Jul 23, 2022
  37. big_3

    big_3

    Joined:
    Apr 20, 2016
    Posts:
    86
    Hi,

    is it possible to create side objects (type "mesh object") with colliders? I've added a box collider to the mesh object, however this does not seem to work. I tried this with the "Lamppost Motorway" side object.

    Can you help me?

    Thanks
    Jus
     
  38. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722

    Hi DanjelRicci,

    What you have reported so far is:

    1. Issue with setting UV coordinates and non square textures and Shape type of side objects. This is fixed in the next update that will be released next week or the weeks afterwards.

    2. An issue with Inspector textfields hitting keys that are also used as short cuts. You confirmed this does not happen with a standard Unity layout. Code related here is Unity scripting API code. If you can send us a simple project with your specific editor setup we can confirm the same happens and we look into it.

    3. An issue with custom connection prefabs, it shows your ramp model in the screenshot. If you can send it to us we can look at it on our end. Or if you can reproduce this with any of the provided assets, please let us know.

    4. The roundabout situation. Roundabouts are tricky, this is up for more optimizations. The radius must be large enough to accommodate the connections on the roundabouts. The recommended workflow at the moment is, add a connection, position it, add the next connection, position it, etc.

    Once you get into a situation where the roundabout does not update checking the position of each connection may help. The blue indicators should be inside the red which represent the positions of the neighbour connections. When selecting the connections from the dropdown this can be used as a reference. When the blue indicators are not inside the red there is a problem with the position. In that case either the position can be updated. If that does not work the connection can be removed.

    In that case, if that is required, the connections can be reordered so the first start near the beginning.

    I will check how the UV tiling is calculated.

    regarding the error, if you can pass your setting we can see if we can reproduce the problem or if this is OSX related, but I don't think that is the case.


    Yes, objects must be marked "static" for lightmapping.

    I will check the situation where prefabs in the project folder are marked as static. Indeed instances in the scene should inherit that state.

    Thanks,
    Raoul
     
  39. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722

    Hi @big_3,

    "Mesh Object" type of side objects will instantiate the assigned prefab. The box collider should be part of it. I just tested it with the lamppost example in the demo package. A prefab was created for the lamppost, the box collider was added to the prefab and this new prefab is assigned to the specific side object. This is the result:

    box-colliders.jpg

    Box colliders are generated, also when the "Combine" option is active for this side object.

    What is the prefab setup?

    Was the prefab changed that is assigned to the specific side object? I am asking this because looking at demo package backups while testing this I see the motorway lamppost side object has changed. It uses the original model now with a "Dual Sided" setup. The original lampposts prefab had to two lampposts, one for the left and one for the right side of the road.

    Thanks,
    Raoul
     
  40. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    308
    I can confirm dynamic Connections do not inherit gameobject settings such as Static and Layer settings, they get spawned on the Default layer and Static is always off.

    About the issue number 3, I think it's about Roads ignoring the Angle Threshold vertically. Look at the slope below: it suddenly changes height but Angle Threshold is set to 1 and should look much smoother than that. It only follows the Resolution value (for reference, here is set at 40).

    Schermata 2022-07-23 alle 15.59.31.png

    About everything else, I want to test the single issues individually on a new project with my custom layout, then send that to you, but I need to cut some time for that. Thanks for the support so far. :)

    EDIT: Sorry but more problems continue to come up just by simply using the plugin in a completely normal environment. I don't really know what to say, at this point I remember why I gave up years ago but I trust there are more gains than losses in using it, so I'm committed to continue- but it's a headache and a gamble in the current state.

    So, I was trying to edit a Road Type from the "gear" tab in the Road Network game object, I disabled the Terrain Deformation checkbox for the specified Road, then I pressed "Update Scene Instances". The progress bar came up and then the editor thrown the error in the spoiler below. The progress bar didn't go away but the editor became partially responsive, I could move the camera but I was unable to click on anything. The error was thrown at every editor refresh.
    I had to save in this state to avoid losing a lot of work but now even if I close and reopen the project, the scene is still in this state. I cannot click on the Road Network or edit anything about it and the error is still being spammed. I hope I can restore it otherwise I lost two days of work.
    EDIT 2: changing the editor layout brings back the editor to a usable state but then the error below seem to trigger almost instantly after I select the Road Network. Before it triggers I am able to move the Markers but in this state I'd say the scene is gone. I don't have time to do anything with the Road Network before the error triggers.


    ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00029] in <695d1cc93cca45069c528c15c9fdd749>:0
    at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
    at EasyRoads3Dv3.OCDCOOQDCD.OCDDCQDDQC (UnityEngine.GameObject go, EasyRoads3Dv3.SideObject so, EasyRoads3Dv3.ERModularRoad roadScr, EasyRoads3Dv3.ERSORoadExt soData, System.Boolean mirrored, System.Boolean isChild) [0x0cc23] in <927f132ec52d421997b8df4ee1fbe906>:0
    at EasyRoads3Dv3.OCDCOOQDCD.OCDCDQDOCO (EasyRoads3Dv3.ERModularBase scr, EasyRoads3Dv3.ERModularRoad roadScr, EasyRoads3Dv3.SideObject so, System.Boolean isParent) [0x0082d] in <927f132ec52d421997b8df4ee1fbe906>:0
    at EasyRoads3Dv3.OCDCOOQDCD.OCCOOQODCD (EasyRoads3Dv3.ERModularBase scr, EasyRoads3Dv3.ERModularRoad roadScr, System.Boolean isSideObjectFlag) [0x0005c] in <927f132ec52d421997b8df4ee1fbe906>:0
    at EasyRoads3Dv3Editor.OCODOODCQD.UpdateSideObjectsInScene (EasyRoads3Dv3.ERModularBase scr) [0x00425] in <2abcfac651c44e0da28b4fdb5c6790e7>:0
    at EasyRoads3Dv3Editor.OOOODDCDDO.OnSceneGUI () [0x00f4d] in <2abcfac651c44e0da28b4fdb5c6790e7>:0
    at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
    at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <695d1cc93cca45069c528c15c9fdd749>:0
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <695d1cc93cca45069c528c15c9fdd749>:0
    at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
    at UnityEditor.SceneView.CallOnSceneGUI () [0x000f4] in /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:3589
    at UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () [0x0000d] in /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2704
    at UnityEditor.SceneView.OnGUI () [0x00459] in /Users/bokken/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2395
    at UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) [0x00099] in /Users/bokken/buildslave/unity/build/Editor/Mono/HostView.cs:416
    at UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) [0x00001] in /Users/bokken/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:381
    at UnityEditor.DockArea.OldOnGUI () [0x0019a] in /Users/bokken/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:372
    at UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) [0x0022c] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/IMGUIContainer.cs:353
    at UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) [0x000b9] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/IMGUIContainer.cs:663
    at UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) [0x00015] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/IMGUIContainer.cs:635
    at UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) [0x00001] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/IMGUIContainer.cs:628
    at UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) [0x00022] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/IMGUIContainer.cs:594
    at UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) [0x00150] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/IMGUIContainer.cs:583
    at UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) [0x00059] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/IMGUIContainer.cs:516
    at UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) [0x00016] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/Events/EventHandler.cs:125
    at UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x0016f] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/Events/MouseCaptureDispatchingStrategy.cs:83
    at UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) [0x00025] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/EventDispatcher.cs:373
    at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00043] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/EventDispatcher.cs:336
    at UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () [0x00035] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/EventDispatcher.cs:299
    at UnityEngine.UIElements.EventDispatcher.OpenGate () [0x0003b] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/EventDispatcher.cs:264
    at UnityEngine.UIElements.EventDispatcherGate.Dispose () [0x00001] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/EventDispatcher.cs:75
    at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) [0x00112] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/EventDispatcher.cs:364
    at UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) [0x00046] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/EventDispatcher.cs:216
    at UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) [0x00010] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/Panel.cs:372
    at UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) [0x000d8] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/UIElementsUtility.cs:461
    at UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) [0x0003d] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/UIElementsUtility.cs:209
    at UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) [0x0001a] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/UIElementsUtility.cs:74
    at UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) [0x00001] in /Users/bokken/buildslave/unity/build/External/MirroredPackageSources/com.unity.ui/Core/UIElementsUtility.cs:28
    at UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) [0x00010] in /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189
     
    Last edited: Jul 23, 2022
  41. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi DanjelRicci,

    I looked at this earlier after you wrote about the static issue.

    The Layer and the Tag should already be inherited.

    Static is added so that will be part of the next update.

    I didn't include the part about using the Angle Threshold features together with connections, this will be added as well in the next update. So point 3. in my list does actually also involve low Angle Threshold values?

    So far the Editor layout and the roundabouts issue remain. For the roundabout exact settings will help. But a scene with this roundabout in it would be very useful.

    I am sure this happened, but I can take the same step, disable Terrain Deformation and press "Update Scene Instances" and the process completes.

    Do you have the additional demo package imported? Can you open the v3.2 demo scene and take the same steps after selecting for example the "Primary Road" type. Do you get the same errors? It completes fine over here.

    So the question here is, what is the state of your road network? Can you include this road type and the scene in the project you mention.

    Saving a scene in a state that causes errors is probably not something you want to do unless you first backup the scene in the project folder in the previous state. That way you can always fall back if necessary.

    You can also send this project / scene, so we can see the state and fix the issue.

    Yes, that is what I mean. When the scene is saved in a state that causes errors, these errors will remain. But we have yet to see a scene that is "gone" as you write.

    I understand that these errors are annoying, the tool is complex and can be used in many different ways. The question here is what is the state of your road network. These last Edits (which are related) in your posts, are the most crucial posts so far. What was the setup of this road type? Are for example side objects activated on these road types?

    The other things you have mentioned were very quick fixes / implementations which have already be done apart from the Angle Threshold feature. I can send an update if you want.

    Thanks,
    Raoul
     
  42. schaefsky

    schaefsky

    Joined:
    Aug 11, 2013
    Posts:
    90
    So I don't know if I understand this correctly, or am overthinking it, but it seems there is a lot of "bookkeeping" involved.
    I currently build roads for every 2 connected nodes and save references to them.
    I then go through all nodes that have 2 roads connected to them and connect them. This means I have to then update all the references since a new road object is created for these 2 roads (I might have to connect them again).
    After that I loop through all nodes that have 3 or more roads connected. I then do road1.InsertFlexConnector, which will give me new road objects for road1 as far as I can tell. I can get the new road objects from the ConnectionData, but how do I map the new road objects to the old road objects to update the "bookkeeping"? I guess I have to search them by markerposition.

    Here is an example what an simple roadnetwork might look like:

    View attachment 1089447
     
  43. schaefsky

    schaefsky

    Joined:
    Aug 11, 2013
    Posts:
    90
    I think I get the same problem (connecting roads with on height map generated roadmarkers by hand to make intersections), for me it helps to go through the intersections and Shift+R delete the closest markers to the intersections to smooth things out. I assumed the problem was that my markers were too close to the intersections, but maybe there is another issue here?
     
  44. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hello schaefsky,

    What exactly do you mean with 2 connected nodes? How are roads build for every 2 connected nodes?

    It seems this is related to the steps I suggested in the post you quoted. That was a way to connect 3 separate road objects with the current API code.

    I also suggested adding additional InsertFlexConnector methods where for example 3 road objects or 4 possibly 4 road objects can be passed. Would that work better?

    That can be added. A new v3.3 beta will also be ready within the next two weeks and we can always send builds so you can already test that.

    The attachment does not load on my end at the moment.

    I guess generating a road network through code involves two things. The road data format, and based on that the actual code. Knowing the road data format may help optimizing the API further for your workflow.

    Thanks,
    Raoul
     
  45. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi schaefsky,

    How dense is your road data? Since you mention that you delete road markers to smooth out the shape, how close are road markers to connections and what are the height differences?

    Markers being quite close to intersections (within 10 units or) at a significantly different height is something to avoid unless the orientation of the intersection is in the same direction. This is also with regard to adjusting the terrain to the road network shape.

    Looking at the screenshot posted by DanjelRicci, it seems this only happens on one triangle strip with no road markers nearby.

    Thanks,
    Raoul
     
  46. schaefsky

    schaefsky

    Joined:
    Aug 11, 2013
    Posts:
    90
    So I have a graph with nodes (index, position, neighbors). The index is more an ID, so indices might look like 0,1,5,3,7 or so. The neighbors are "unique", so there is always only one edge between nodes (not bidirectional).

    upload_2022-7-24_0-11-42.png
    (Hope this attachment works, also can not access the original one)

    So for every edge I build my intial roads. The network then consists of a bunch of straight roads with 2 markers each.

    I save the roads connected to each node. This is the "bookkeeping" that has to be constantly updated during (most of) the operations preformed below, because the road objects keep changing.

    I then connect all roads that do not form an intersection.
    So in the image above e.g. I will build road1 (4,3) and road2 (3,2), then I will connect them which gives me road3 (4,3,2).
    After doing that for all roads that don't form an intersection, I will then build the intersections, let's say road3 (4,3,2), road4 (0,1,2) and road5 (2,6): Connect road3 and road4 to get road6 (4,3,2,0,1), then road6.InsertFlexConnector(road5) which I think will split road6 to road7 and road8. So I get a connection with road7(4,3,2), road8(0,1,2) and road5(2,6) connected.

    Then I would make an intersection for road8(0,1,2) and road9(1,10,7) and road10(1,7)
    So this the where "bookkeeping" part gets complicated, because road8 started as roadA(0,1) and roadB(0,2), got connected to road4(0,1,2), while building the intersection became part of road6(4,3,2,0,1), and then gets split again to "finally" become road8.

    So an InsertFlexConnector with 3 or more road objects could help, but I think what would really help would be a way to get the newly split road7 and road8 (and possibly the "new" road5 if this will be a new road object) when inserting a FlexConnector. Maybe some out parameters?

    Of course the icing on the cake would be a top down approach whith specifying the nodes and their connections, and EasyRoads doing all the complicated stuff to create the roads.
    My code for doing the above with GeNa looks like this:
    Code (CSharp):
    1.                 var gs = GeNa.Core.GeNaSpline.CreateNewSpline("townRoadsSpline");
    2.  
    3. ...add extensions to the spline to make it a road building spline...
    4.  
    5.                 var indexToNode = new Dictionary<int, GeNa.Core.GeNaNode>();
    6.                 var graph = mTownRoads.GetGraph();
    7.                 foreach (var node in graph.Values)
    8.                 {
    9.                     indexToNode.Add(node.index, gs.AddNode(new GeNa.Core.GeNaNode(node.position)));
    10.                 }
    11.  
    12.                 foreach (var kv in graph)
    13.                 {
    14.                     foreach (var neighbor in kv.Value.neighbors)
    15.                     {
    16.                         gs.AddCurve(indexToNode[kv.Key], indexToNode[neighbor]);
    17.                     }
    18.                 }
    Of course GeNa seems to be lacking a lot of other features, e.g. different road types per spline (network).
     
  47. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi schaefsky,

    With regard to bookkeeping, at any point it is possible to get all connections / intersections in the scene, all road objects and which which road objects are connected to which intersections.

    I will add that to the current InsertFlexConnector(). That will be one new road object, the other two are already known, the original road object and the second road object that is passed.

    So when you are talking about nodes are these road markers or connections / intersections.

    Within EasyRoads3D we have road objects based on road types that exist of road markers. When the connections between the road objects are known, everything can be generated, also with v3.3 Flex Connectors when the API is fully integrated. In your code example a graph is used. That can be added as well and it is this part that I was asking questions about, what is your data format that you want to use to auto generate?

    Thanks,
    Raoul
     
  48. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    308
    Hi Raoul,

    I just did a few tests in a clean project with only the Demo Scene v3.2+, Unity 2020.3.36f1, using my own editor layout:

    - I was able to replicate the roundabout issue. Create a new roundabout > Increase radius > Delete all Connections except one > Add two connections > The error occurs.
    - Typing i in a Inspector text field creates a Marker like I reported before.
    - I didn't get any error when updating my Road Network after changing the Terrain Deformation checkbox.
    - Roads coming out of custom Connections behave like I and schaefsky reported.
    - Roads coming out of the new Flex Connector seem much smoother than other Connections- I might consider trying to use v3.3 Beta for that.

    About my own Road Network, yes two types of Road have different Side Objects both mesh based and shape based, but the network is still not complete as I have to add a lot of stuff yet. I will send you soon a project with that network, the related objects, and my editor layout so you can review it. Hopefully it can be restored in some way!

    EDIT: success! Mostly so. I managed to delete all Side Objects from the ER Modular Base component, then I also manually removed any leftover child GameObject from Roads, and now everything looks smooth, I can update the Road Network and do other operations without getting errors. Side Objects weren't a great loss luckily as I can recreate them quickly, good thing the Road Network itself is still in place, that's the most important part.
     
    Last edited: Jul 24, 2022
  49. schaefsky

    schaefsky

    Joined:
    Aug 11, 2013
    Posts:
    90
    Just to clarify, I am not using custom connections, only Flex Connectors, and it might well be on my end that when this happens the next marker to the intersection is too close.
     
  50. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    308
    Do you mean the Flex Connectors from 3.3? Because I get that issue with both Custom and Dynamic Connections from 3.2 even when the marker is not very close. But Flex Connectors from 3.3. behave much better at that in general.