Search Unity

World Building EasyRoads3D v3 - the upcoming new road system

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

  1. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    243
    Thanks!

    On the topic of workflows with flex connectors, is there an easy way to add intersection in this scenario? SampleScene_-_ER3D-Test-2019_2.png

    My current workflow is to move the marker(s) away from the intersection, select the marker on one of the roads (either a mid connector or end connector depending on what was in the OSM import), then connect all the other roads, convert to flex and then try to remember the original layout and drag the roads back into position. Obviously the downside of this procedure is that I lose the original layout. Is there a simpler way to create the intersection that would avoid losing the original positions of the roads?

    I've also got this issue:
    1-SampleScene_-_ER3D-Test-2019_2-offset.png

    The upper intersection (see aerial image below) is just offset from the opposing street, but they are too close together to fit 2 T-crossings. I've faked it with a flex connector and angling the connection, but the only other solution I can think of is to create a custom crossing pre-fab. That might be a nice feature to include in 3.3 or something.

    1-Google_Maps.png
     
  2. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Have you tried moving the other markers away and then back over the road to the same position? Just like starting a new road from a road, roads can also snap to other roads. A blue handle appears when the road can snap to the other road, releasing the mouse button will insert a T Crossing in this case. Which can then be converted into a Flex Connector.

    The image shows two crossings, there is not really a clear road section in between the two. You could try to do this in a similar way by placing two T crossings and align them. This is currently not a built-in options but yes, snapping crossing prefabs together is on the list to add. The other way to do this is indeed this with a modeled section imported through the Custom Prefab system.

    Thanks,
    Raoul
     
  3. TrueProger

    TrueProger

    Joined:
    May 26, 2017
    Posts:
    40
    Hello! How do I reduce the width of the width of the left and right indents? At the moment there is a significant 19. And I can’t reduce it either, I’m writing from 0 to 19 there will always be 19. How to make this value smaller?
     
    Last edited: Jul 21, 2019
  4. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Bogat,

    These values are locked to a minimum value required based on the terrain object in the scene. If these Indent values would be below this value it is very likely the road will break through the terrain or the road will float above the terrain in non flat areas. It mean that there are not enough terrain points available to adjust the terrain to the road shape.

    19 is fairly high, what is the terrain heightmap resolution and terrain size? The higher this value the more limitation there will be on road height changes in hilly areas.

    Thanks,
    Raoul
     
  5. TrueProger

    TrueProger

    Joined:
    May 26, 2017
    Posts:
    40
    View attachment 453788 View attachment 453791
    I need to set a minimum value of 5, I have wide roads, the size of them is 10 and 15. Could I give a script that I could press the button and be able to measure the size of the indent?
     
  6. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    The minimum required indent values is a little bit higher then the terrains heightmapscale which is the size of a single terrain grid cell (terrain size / heightmap resolution). That is why I asked about the terrain heightmap resolution and terrain size.

    Thanks,
    Raoul
     
  7. TrueProger

    TrueProger

    Joined:
    May 26, 2017
    Posts:
    40
  8. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    6500 size, 513 heightmap resolution. That explains the high minimum required indent value. Each terrain cell covers about 13 units. The default terrain settings used to be 2000 x 513, which results in more or less in a minimum indent value you want to use, 5. The current default terrain settings are 500 x 513, which is about 1 unit per terrain cell.

    Thanks,
    Raoul
     
  9. TrueProger

    TrueProger

    Joined:
    May 26, 2017
    Posts:
    40
    And how should I be? The size of the map in the current project can not be reduced! Your ideas?
     
  10. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    The heightmap resolution can be increased a little bit. The terrain can be split in multiple terrain chunks, that is what most do when working with larger maps.

    Thanks,
    Raoul
     
  11. vpamidi

    vpamidi

    Joined:
    Apr 18, 2019
    Posts:
    11
    Hi,

    I would like to edit road width of the selected road which is dragged from the custom prefab junction(style3_fade_2_to_3lanes_ER) shown in figure. Road width field is not editable. Could you please let us know how to edit road width of the selected road here.

    upload_2019-7-22_12-57-13.png

    Thanks & regards,
    Vijayalakshmi
     
  12. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi vpamidi,

    style3_fade_2_to_3lanes_ER looks like a model created by you and imported in the system. The width of connections of this type of custom connection prefabs are not editable because they are based on an imported mesh, that is why the width of attached roads are not editable either in the current public version.

    Looking at the image everything seems correct although the road width appears to be slightly wider then the road section on the connection prefab. What is the setup of this connection in the Custom Prefab Editor window? Is this more a matter of adjusting the UVs in the Custom Prefab editor window?

    Regarding editing the road width, in theory, and certainly doable in the v3.2 betas it is possible to change the width of a road type.When the road connects to a crossing with a fixed width the width of the road will gradually adapt. I see the road type dropdown does not show a road type. Is the custom connection prefab setup in a way that a new road type was created in the Custom Prefab editor window?

    Thanks,
    Raoul
     
  13. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Hi Raoul,
    I am looking at generating roundabouts using a script. However, there is little/no indication about it in the documentation. If I access the ERRoundabouts component of the connection, I can change some properties like the radius. However, these changes do not take effect until I press the "Refresh Roundabout" button in the gui.
    Is there any way to access/alter the roundabout using the API?
    Additionally, is the roundabout supported by the traffic/AI system? If I instantiate a default roundabout and press the "Reset all Connections" button in the settings GUI, I get a log message "EasyROads3D: The lane data on connector Roundabout 4 connections could not be updated".

    Kind regards,
    Christian
     
  14. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Christian,

    For both crossings and roundabouts the current scripting API implementation does not have options to customize them, only to add them to a scene and connect roads, also for already customized roundabouts. Accessing the ERRoundabouts component and making changes is at your own risk :), indeed a Refresh will be required in that case. For example ERConnection.Refresh() can be added if that would help.

    Is the question only related to setting up roundabouts through the scripting API or also about Instantiate roundabouts through the scripting API and connecting roads?

    The v3.2 beta AI lane options are indeed not yet available for roundabouts. This requires a different approach then the one for X, T crossings and the Flex Connector. It is being worked on.

    Thanks,
    Raoul
     
  15. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    If I could access (even in a convoluted way) all the options of customizing the intersections/roads using the API, I would be very happy. Being able to set all the parameters in the GUI from the script and then calling ERConnection.Refresh would be a nice workflow. Maybe the Refresh has to trigger after every change, as some options become invalid in certain combinations (road types if the connector is set to uniform for example).

    I can already instantiate the roundabouts, as they seem to be simply considered to be an ERConnection, so it more about setting up an instantiated roundabout, connecting roads, adding connectors, changing radius etc.

    Code (CSharp):
    1. ERRoadNetwork network = new ERRoadNetwork();
    2. ERConnection connectionSource = network.GetSourceConnectionByName("Roundabout 4 connections");
    3. connection = network.InstantiateConnection(connectionSource, "Roundabout", position, new Vector3(0.0f, 1.0f, 0.0f));
    I'm aware you just recently released a new beta, but is there any ETA/schedule for future releases? This feature, as well as native on/off ramp support are some things I really look forward to!
     
  16. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    This Refresh() option can be added. It can be triggered whenever the roundabout needs to be updatet. Roundabouts are tricky though, the number of connections, the connection widths, the radius having to be large enough to match these settings, etc. In any case, I will add this and send you an update so you can test this.

    There is no public schedule. Especially the current updates are time consuming, the Flex Connector requiring a different approach for sidewalks meaning sidewalks need to be updated as well. On/off ramps which are fully customizable in various ways. It is a time consuming process which makes it hard to set a schedule. Sometimes a week passes by getting a small but crucial thing to work in a stable way. The only way to push this and make it available is by releasing alpha versions to those who do not mind to work around the glitches and features that are not ready yet.

    The current status of on/off ramps is that support needs to be added for a reversed shape for on ramps and support needs to be added for ramps on the left side of the road in case both the left and right side are done with a single road object. Other then that, before releasing this in a first beta ideally some optimizations are added that will auto adjust specific shape settings based on the adjustable start curve of the ramp. This is not required because the shape of the remaining part can be adjusted manually, but it will make it more friendly.

    Thanks,
    Raoul
     
  17. unitypolska2000

    unitypolska2000

    Joined:
    Sep 23, 2013
    Posts:
    8
    Hi Raoul,
    Do you have an idea, how to fix that?
    ER_problem.PNG
     
  18. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi unitypolska2000,

    What does this look like in Edit mode with "General Settings > Hide White Surfaces" toggled off?

    When these surfaces are not generated correctly it will result in wrong terrain deformation like in your image

    This is a custom connection prefab based on your model. Issues like this are usually a result of the connections not being added in clockwise direction in the Custom Prefab Editor window.

    If that is not what is causing this on your end, would it be possible to have a look at the model and test it?

    Thanks,
    Raoul
     
    unitypolska2000 likes this.
  19. unitypolska2000

    unitypolska2000

    Joined:
    Sep 23, 2013
    Posts:
    8
    Okay, adding connections in clockwise direction solved the problem, thank you soo much.
     
    raoul likes this.
  20. unitypolska2000

    unitypolska2000

    Joined:
    Sep 23, 2013
    Posts:
    8
    Hi again Raoul,
    I have another question. Is there a way to create ditch around my road? Like on this picture? Thanks. 95957516-country-dirt-road-and-ditch-on-a-cold-winter-morning.jpg
     
  21. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi!

    That is a narrow ditch. What are the terrain specs, the heightmapscale (terrain size vs heightmap resolution)? It must be very small to create a smooth narrow ditch like in your image directly in the terrain object itself.

    Or can it be wider? In that case it can be done using side objects, have a look at the "Deformation Object" checkbox option in the General Settings in the Side Object Manager. The "River Bed" side object in the demo package is an example of this. That one is done using a Shape Type of side object. A Procedural side object type with Start / End sections with these Start / End sections at y = 0 can also be used here. That way the ditch will start and end at the road height level.

    This will not work for a lower resolution terrain. For example, the terrain in the demo package is less detailed. The above approach will not work. Bu it is still possible to do this if you dig deeper in the tool, especially side objects.

    ditch.jpg

    Not so good quality, but this is from the demo package scene. The edge of the road and the right side of the water is a side object snapped to the terrain further to the right. The terrain is deformed lower below the road through a side object in a similar way as described above. The terrain surface side object snaps to the terrain just outside where terrain deformation stops.

    Let me know if you have further questions.

    Thanks,
    Raoul
     
    unitypolska2000 likes this.
  22. PhilipZ0

    PhilipZ0

    Joined:
    Mar 5, 2019
    Posts:
    16
    Hi Raoul,

    I have a question about creating roads. I have added guardrail side objects in editor and lane for creating multi-lane highway, it works great. I need to create the same roads in runtime. At the moment I only get road type and width right, but there guardrail and lanes are not added.

    Did you mention side objects support is added in 3.18 update, I have 3.17 at the moment. How can I update the Road Network without losing the side objects and all the setup? Is it only by drag and dropping new version package?

    The scripts for creating road looks like this:

    ERRoad createNewRoadSegment(Vector3 endMarker)
    {
    Vector3[] markers = new Vector3[2];
    markers[0] = new Vector3(endMarker.x - _roadOffset, endMarker.y, endMarker.z);
    markers[1] = new Vector3(endMarker.x + _roadLength, endMarker.y, endMarker.z);
    string roadName = _roadNamePrefix + _roadNameCount.ToString();
    _roadNameCount++;

    ERRoad road = _roadNetwork.CreateRoad(roadName, markers);
    road.SetRoadType(_roadType);
    road.SetWidth(_roadLen * 2);
    return road;
    }


    Maybe it is easier to save the road (with side objects and lines) as prefab and just Instantiate prefab at the end of the road? Thanks for the support!
     
  23. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi PhilipZ0,
    Yes, v3.1.8 does have side object control added to the scripting API. The package can simply be imported over the existing version. It is recommended to always backup first, just in case...

    Alternatively, if these side objects should always be active on all markers and when working with a road network that is already in the scene, the side objects could be activated for the specific road type. They will be build automatically.

    Perhaps this is less relevant for runtime road creation but generally it is not recommended to change the width of a road object directly on the road. It is better to this for road types. The scene will be better manageable also with regard to crossings. But perhaps this is not so relevant in your situation.

    What exactly will this look like? Should this still be editable? Why is it instantiated at the end of a road? Or is it a straight section with the same section repeated, a section that will always look the same? That would probably be more efficient in that case.

    Thanks,
    Raoul
     
  24. PhilipZ0

    PhilipZ0

    Joined:
    Mar 5, 2019
    Posts:
    16
    This works great only if I have call roadNetwork.connectRoads(firstSegment, nextSegment). I have a question about deleting the part of the road from some position. For example, I create firstSegment road and at the end, I connect the nextSegment with same road type. After the object goes in the middle of nextSegment, how do I cut off the firstSegment since it is now a single ERRoad object? Maybe you have an idea to do it without connection. Without connecting them, the side objects are not aligned, even though I have set them and refreshed the network.


    At the moment, I am creating at the straight repeating road. But the approach with instantiating prefab is not working as it should. I am instantiating the object under the RoadObjects, but the road is not created. I would stick with the solution from the first part.

    Thank you for the update.

    One m more thing when I put the road I had to change Y coordinate of road +0.01 to avoid grass texture getting over the road in some places. After that, I click Apply Transform Changes and it is good, but when I create a road with runtime I could not do that. How do I solve this problem, image in the attachment.
     

    Attached Files:

    Last edited: Jul 24, 2019
  25. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Because you mention road segments, prefabs and roadNetwork.connectRoads(firstSegment, nextSegment), can you explain a little bit more about your project?

    If this is something like an endless road? The marker positions can be updated instead of creating new road objects and connecting them.

    When the road sections are created by instantiating prefabs it sounds like EasyRoads3D was used to create the prefab, but it is no longer involved when instantiating these prefabs. What exactly are the steps here and what is the problem?

    Is this a situation described on the Troubleshooting page in the manual where the road / terrain is leveled at the terrains Y position? Meaning that the terrain cannot be leveled accurately because the Unity terrain object does not accept negative height values. In that case, please use a terrain that is flattened higher above the terrains Y position.

    In any case, changing the Y position of the road object will probably not work well. Instead you can try adjusting the Raise level, ERRoadNetwork.SetRaiseOffset(float value)

    Thanks,
    Raoul
     
    PhilipZ0 likes this.
  26. PhilipZ0

    PhilipZ0

    Joined:
    Mar 5, 2019
    Posts:
    16
    This is probably the best solution. I am making the endless road by adding segments of 1km length. I am deleting the segments from before and adding segments ahead. Can you write a few lines how you think it is possible to update marker positions? Thanks!
     
  27. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Individual markers
    ERRoad.SetMarkerPosition(int index, Vector3 position)

    All markers
    ERRoad.SetMarkerPositions(Vector3[] positions)

    A selection of markers starting at index
    ERRoad.SetMarkerPositions(Vector3[] positions, int index)

    Thanks,
    Raoul
     
    PhilipZ0 likes this.
  28. OwlTheoryMusic

    OwlTheoryMusic

    Joined:
    Jun 21, 2018
    Posts:
    39
    Thanks! I've been searching for something like this.
     
    raoul likes this.
  29. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    @PhilipZ0

    You may also want to look at

    ERRoad.AddMarker(Vector3 position)

    and

    ERRoad.DeleteMarker(int index)

    Thanks,
    Raoul
     
  30. unitypolska2000

    unitypolska2000

    Joined:
    Sep 23, 2013
    Posts:
    8
    Hi Raoul,
    It's me again ;) Just wanted to ask about another thing. How can I create road under bridge like here?
    Btw. Ditch works perfectly :D
     

    Attached Files:

  31. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi unitypolska2000,

    How is the bridge added?.Because you are extensively using the Custom prefab system, is this actually a prefab with roads connected? In that case you probably want to switch of "Terrain Deformation" for the bridge prefab in the Custom Prefab Editor window. Or the road below the bridge must be higher relative to y=0 for the bridge prefab

    Otherwise, if the road on the bridge is actually a road object, then Terrain Deformation can be switched off for the involved markers.

    In both cases the road going under the bridge will flatten the terrain as usual.

    Good to hear that! :)

    Thanks,
    Raoul
     
    unitypolska2000 likes this.
  32. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Hi Raoul,
    I gave up on using the roundabout, trying to hack together a scripting interface for them did not work out as I hoped using the ERRoundabouts script. Given that I am currently only having one large roundabout which can be approximated using a single lane road and flex connectors I am not too concerned.

    However, I struggle with getting internal ArgumentOutOfRangeExceptions if I try to attach Default T Crossings. The stack trace looks like shown below, the last row is still from my code.
    Code (CSharp):
    1. ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    2. Parameter name: index
    3. System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    4. System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    5. System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    6. EasyRoads3Dv3.OCCQDQCDDD.OOQQOCOOQD (EasyRoads3Dv3.ERModularBase baseScript, System.Collections.Generic.List`1[UnityEngine.Vector3]& vecs, System.Collections.Generic.List`1[T] tValues, System.Single heigthOffset, UnityEngine.Vector3& lastHeightAdjustCP, System.Single resolution, System.Single distance, System.Boolean nextMarkerContourAdjust, System.Collections.Generic.List`1[T] currentVecs, System.Collections.Generic.List`1[UnityEngine.Vector3]& testPoints, System.Collections.Generic.List`1[System.Single]& randomRotations) (at <e868b16cc53d4d4ea96de94e7361b009>:0)
    7. EasyRoads3Dv3.ERModularRoad.OODDCQQDOD (System.Collections.Generic.List`1[T] markersExt, System.Single faceDist, System.Boolean ignorePrefabAlignment, System.Collections.Generic.List`1[System.Single]& tValues, System.Collections.Generic.List`1[System.Single]& markerDistances, System.Boolean forceAutoRotate, System.Collections.Generic.List`1[System.Single]& rotationArray) (at <e868b16cc53d4d4ea96de94e7361b009>:0)
    8. EasyRoads3Dv3.ERModularRoad.OCQQODOQOD (System.Boolean ignorePrefabAlignment, System.Boolean forceAutoRotate) (at <e868b16cc53d4d4ea96de94e7361b009>:0)
    9. EasyRoads3Dv3.OCCQDQCDDD.OCCDQQOCCD (EasyRoads3Dv3.ERModularRoad scr, UnityEngine.Vector3 OCOCOOODOC, EasyRoads3Dv3.ERCrossingPrefabs OCOCCCQDCD, System.Int32 targetElement, System.Boolean reverse, System.Boolean uvReverse, System.Boolean forceAutoRotate) (at <e868b16cc53d4d4ea96de94e7361b009>:0)
    10. EasyRoads3Dv3.ERRoad.ConnectToStartExt (EasyRoads3Dv3.ERConnection connectionObject, System.Int32 connectionIndex, System.Boolean autoAlign) (at <e868b16cc53d4d4ea96de94e7361b009>:0)
    11. EasyRoads3Dv3.ERRoad.ConnectToStart (EasyRoads3Dv3.ERConnection connectionObject, System.Int32 connectionIndex) (at <e868b16cc53d4d4ea96de94e7361b009>:0)
    12. TCrossingHolder.ConnectToRoad (System.Int32 idx, System.Int32 connIndex) (at Assets/Aperol/Scripts/Editor/RoadCreator/IntersectionHolder.cs:268)
    I have attached the scene with the road network. Street 1 is mangled somehow and the last marker seems to be missing somehow. Unfortunately, I can not share the entire code which created this setup. Maybe you can have a look at it. It looks like I managed to delete the marker without giving the road the chance to update its internal marker count if I had to guess.

    Regards,
    Christian
     

    Attached Files:

  33. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Christian,

    It is 23.30pm over here at the moment. I will look at this tomorrow. But it seems the scripting API is involved here, I am not sure if a scene file will work. Can you include your script?

    If EasyRoads3D assets are included, could you then please email packages instead of attaching them here?

    Thanks,
    Raoul
     
  34. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    @eGoMobile

    The error can indeed be reproduced with the scene file only. It is a result of marker positions very close to each other. After moving marker 5 of the non-straight road away from marker 4 or increasing the road resolution, the problem disappears. I will look into this situation to see what causes the error.

    This specific section with the 3 markers close together can be done with two markers and the Circular controller. That will result in a smooth turn without errors.

    https://forum.unity.com/threads/eas...-new-road-system.229327/page-141#post-4742912

    Thanks,
    Raoul
     
  35. nmbileg

    nmbileg

    Joined:
    Sep 29, 2017
    Posts:
    23
    Hello again, Raoul! I have a question, can I add these kinds of roundabouts (picture below) using script on runtime? Thanks!
     

    Attached Files:

  36. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hello nmbileg,

    The package itself includes a roundabout example with 4 connections.

    General Settings > Crossing / Connection Prefabs

    Here new Roundabout prefabs can be created like the other roundabout with two connections. Note that depending on the Unity version you are using there might be a problem in the current version editing the roundabout. This is fixed in the next update.

    Adding these roundabouts through the scripting API and attaching roads works the same as for X and T Crossings. It is recommended to instantiate them to the scene and connect roads rather then attaching them directly to a road, ERRoad.ConnectToEnd() or ERRoad.ConnectToStart() rather then ERRoad.AttachToStart() or ERRoad.AttachToEnd()

    Thanks,
    Raoul
     
  37. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Dear Raoul,
    Please do not bother answering my late night questions this quickly! I never expected you to still answer last night, thank you so much!
    Are there any concerns from your side from me sharing scene files like this in future? I do not want to bring you in any unfortunate situation.

    Regarding the actual issue at hand: Thanks for the debugging help. I did not expect the error to be related to nodes further away from the crossing. As I do not set the nodes manually but rather parse them from OSM data, I can not/don't want to adjust them manually. I will try to find a proper heuristic to automatically move/remove nodes which might result in this issue.

    Kind regards,
    Christian
     
  38. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Christian,

    Posting the scene file is absolutely fine. The error message showed references to ERRoad, scripting API, my first thoughts were that the problem was perhaps code related, how the roads were generated. That is why I asked for the script too. And just to avoid the situation where you would perhaps include a package with EasyRoads3D assets, which has happened before, I thought I mention sending packages by email.

    The crossing is not involved in this. Only these two markers (3 and 4) being so close, 2.12m, is what causes this for this specific road. It is not that markers cannot be so close. I tried to replicate this in the same scene, a road with a very similar shape. It works fine also when both markers are almost on the same spot. So this will have to be debugged further on that specific road. But generally you do want larger distances between markers anyway.

    Thanks,
    Raoul
     
  39. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Hi Raoul,
    What is a recommened minimum distance between roads? I have attached a scene where the distance between nodes is 13.97 meters, however something wonky still happens at the end of the road. The data I am working with seems to be generate errors like this quite regularly and if possible I do not want to delete nodes which are this far apart, I would lose a lot of the detail in the map otherwise. The problem seems to occur if two nodes are close together after a long stretch without nodes. Notice how the distance between nodes 2 and 3 is 120m, and I think it was similiar in the last scene I posted as well. The error can be reproduced by hand this way as well: Start a new street. Place the second node a large distance (100m or so) away, then place a third node relatively close to the second in a straight line.
    It looks like the road "overshoots" to behind the third node, thus then sharply curving onto itself. The further the first and second node are apart, the more pronounced this effect becomes.

    Kind regards,
    Christian
     

    Attached Files:

    Last edited: Jul 25, 2019
  40. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Christian,

    This road does not throw exceptions, this is a different situation.

    In this scene the distance between node 1 and 2 is 13.97. The distance between node 2 and 3 is 116. Please try to avoid such large differences or adjust the spline strength, ERRoad.SetSplineStrength(int index, float strength).

    This road shape is the result of distances between the nodes and control points. Add a road with 4 markers in the scene manually and play around with all 4 marker positions, from more or less equal distances to large differences. see how that affects the shape of the road.

    Thanks,
    Raoul
     
  41. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Hi Raoul,
    If you try to attach a road at the end of the road with a script, an exception will be thrown. I have updated the file in my previous post to better reflect this. The exception which is thrown is attached below:
    Code (CSharp):
    1. EasyRoads3Dv3.ERModularRoad.OCQQODOQOD (System.Boolean ignorePrefabAlignment, System.Boolean forceAutoRotate) (at <e868b16cc53d4d4ea96de94e7361b009>:0)
    2. EasyRoads3Dv3.OCCQDQCDDD.OCCDQQOCCD (EasyRoads3Dv3.ERModularRoad scr, UnityEngine.Vector3 OCOCOOODOC, EasyRoads3Dv3.ERCrossingPrefabs OCOCCCQDCD, System.Int32 targetElement, System.Boolean reverse, System.Boolean uvReverse, System.Boolean forceAutoRotate) (at <e868b16cc53d4d4ea96de94e7361b009>:0)
    3. EasyRoads3Dv3.ERRoad.ConnectToStartExt (EasyRoads3Dv3.ERConnection connectionObject, System.Int32 connectionIndex, System.Boolean autoAlign) (at <e868b16cc53d4d4ea96de94e7361b009>:0)
    4. EasyRoads3Dv3.ERRoad.ConnectToStart (EasyRoads3Dv3.ERConnection connectionObject, System.Int32 connectionIndex) (at <e868b16cc53d4d4ea96de94e7361b009>:0)
    5. TCrossingHolder.ConnectToRoad (System.Int32 idx, System.Int32 connIndex) (at Assets/Aperol/Scripts/Editor/RoadCreator/IntersectionHolder.cs:309)
    I will either change the spline strength or will implement a fix in my code to oversample the curve if the distance between nodes becomes too large. There is a function GetPosition, which gives the position of the spline as a function of distance. Is there a straight forward way to get the distance from a marker index?

    Kind regards,
    Christian
     
    Last edited: Jul 25, 2019
  42. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    So how can I connect cross dirt path like shown in the image?
     

    Attached Files:

  43. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Christian,

    This appears to be crossing related rather then connecting two roads? I don't think there is an issue with ERRoad.ConnectToStart(). I just tested it.

    There is no file attached this time so I cannot check. Do the involved road types match?

    Yes, you could compare distances and insert a node halfway if the difference is significant. That will solve the problem in your previous example where the distance of the second section is about 10 times larger then the first.

    Thanks,
    Raoul
     
    Last edited: Jul 25, 2019
  44. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi,

    This can either be done by creating a model that looks like the one in your images and import it through the custom prefab system. The connection will behave the same a built-in crossings.

    Or this could be done through the Flex Connector in the v3.2 betas.

    frmFlex.jpg

    This does require a detailed terrain object unless all roads and crossings are exactly aligned at the same height.

    And the HD Roads package also includes Y type of dirt crossings required for this.

    Thanks,
    Raoul

    Thanks,
    Raoul
     
  45. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    You have a video?
     
  46. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    A video of the Flex Connector option?

    The image shows 3 Flex Connectors with 3 short road objects between them and 3 outgoing road objects.

    http://unityterraintools.com/v3beta.php

    Thanks,
    Raoul
     
  47. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    243
    Is there a simple way to produce an "endcap" side object from the main shape? e.g. I have defined (wholly within ER3d) a center curb divider with left and right side objects as shapes. I would like to have the ends finished by sweeping a quarter circle with the shape, but that doesn't appear to be an available feature. It seems as though I'm going to have to create the full object in Blender or ProBuilder. Is there a simpler solution I'm not seeing? Assuming there isn't, I've got a couple feature suggestions:
    1. Mirror option for shape-based side objects, either as the second object exists as a separate side object, but linked to the first and the shape mirrored, or as mirrored directly within the single object, e.g. the x-offset would be applied to the original and -x to a mirror. The variations settings could be generated randomly independently from identical settings
    2. Automated geometry options for ending shapes
      • sweep on circle: x offset of center, finish x-offset (i.e. sweep around point, then straight to finish x-offset)
      • miter and straight to x-offset: miter angle, finish x-offset (i.e. just extrude straight line at angle to x-offset and join with a miter
    I'm assuming neither of those are currently possible with the scripting API.
     
  48. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Colin,

    I think you are referring to auto generating Start / End Objects for the corresponding slots in the Side Object Manager?

    That is tricky. It is not something that EasyRoads3D does. The generated shapes can have any
    arbitrary mesh / shape as the input. It is not that simple to auto create start / end caps for every situation.

    Indeed the usual way, especially for the procedural side object type, is to model the source object and also the start / end caps in modelling app like Blender or ProBuilder.

    1. Currently it is possible to duplicate the side object and mirror the shape in the Shape Editor window.

      V3.3 will have a side object upgrade. The idea is to simplify left / right side of the road versions of side objects if that is what is involved here? One side object that can be used on both sides of the road.

    Is this for the Shape type of side objects? I guess this is something similar as currently done for sidewalks. This is also planned for side objects. This can get fairly complicated though since any type of shape can be generated.

    Solutions will be added for basic shapes, but doing this in a modelling gives a lot more freedom and control. The procedural side object type with options to quickly cut the source model in start / mid / end sections deals with this situation.

    Thanks,
    Raoul
     
  49. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    I edited the previous post (https://forum.unity.com/threads/eas...-new-road-system.229327/page-143#post-4784426).

    I think the problem occurs with the street overlapping itself (due to the large difference in distances), and then attempting to generate a crossing at the node which is semi hidden underneath its own road. But after you gave me the hint about this being related to the large difference in node distances, I was able to fix my problem by inserting nodes until they are close enough together.

    Kind regards,
    Christian
     
  50. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Christian,

    Thank you for posting this update! Glad to hear that connecting roads to crossings through the scripting API was actually related to this same situation with large differences between node positions.

    Thanks,
    Raoul