Search Unity

World Building EasyRoads3D v3 - the upcoming new road system

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

  1. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    239
    When I use the crossing, the road will become as narrow as the crossing, and the width of the road can no longer be changed (the width value becomes gray). What can I do to change the width of the road and crossing?
     
  2. raoul

    raoul

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

    Before asking to do that test in the new project I did the same over here. The build succeeds, it was Unity 2018.3.0f2, . neither has this been reported before recently.

    Could you upload this last test project to a filesharing site and email the link to us, or send a PM?

    Thanks,
    Raoul
     
  3. raoul

    raoul

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

    It is very much recommended to work with road types.

    General Settings > Road Types

    Here, among others, the road width can be set.

    A for this road type specific new dynamic crossing can be created easily afterwards through the "Create New Connection Prefab" button below the material options. "Connection Material" refers to the material that will be used on the connection / crossing prefab.

    This new connection prefab will now be available in the Connections Prefabs tab (3rd from the left in the Inspector).

    The prefab itself will be stored in /Assets/EasyRoads3D/Resources/dynamic prefabs/. From there it can be customized further, for instance the sidewalk settings or add props.

    At any time the width of this road type can be adjusted in the road types settings. The "Update Scene Instances" button near the bottom will update all the roads and crossing where this road type is used.

    Thanks,
    Raoul
     
    AngelBeatsZzz likes this.
  4. Binary42

    Binary42

    Joined:
    Aug 15, 2013
    Posts:
    207
    I'll check again if entering the long/lat:coordinates will work, so far that seemed to have no effect.
     
  5. raoul

    raoul

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

    If the long/lat coordinates of the terrain are known and the node coordinates of the osm data file are inside these bounds then the roads should parse. If you want you can pass the details here or by email and we will have a look.

    Thanks,
    Raoul
     
  6. mattes3

    mattes3

    Joined:
    Apr 23, 2019
    Posts:
    15
    Hi,

    today I purchased the ER Pro version from the asset store and tried it on my project. I added this code (found it on this forum in some post further above):

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEditor;
    4. using UnityEngine;
    5. using EasyRoads3Dv3;
    6.  
    7. public class RoadFirstTry {
    8.  
    9.     [MenuItem("EasyRoads3D/I Connector Test")]
    10.     public static void IConnectorTest() {
    11.         ERRoadNetwork network = new ERRoadNetwork();
    12.         List<Vector3> markers = new List<Vector3>();
    13.         for (int i = 0; i < 10; i++) {
    14.             markers.Add(new Vector3(500, 0, 500) + Vector3.right * 40.0f * i);
    15.         }
    16.         ERRoadType roadType = network.GetRoadTypeByName("Default Road");
    17.  
    18.         var road = network.CreateRoad("Highway", roadType, markers.ToArray());
    19.  
    20.         road.InsertIConnector(7);
    21.         road.InsertIConnector(5);
    22.         road.InsertIConnector(3);
    23.  
    24.     }
    25.  
    26. }
    27.  
    When I click the new menu, I get an error message in the console window:
    NullReferenceException: Object reference not set to an instance of an object
    EasyRoads3Dv3.ERRoad.Refresh () (at <69cf1a9e593e4f2ca7976a517a06d72c>:0)
    EasyRoads3Dv3.ERRoad.SetWidth (System.Single width) (at <69cf1a9e593e4f2ca7976a517a06d72c>:0)
    EasyRoads3Dv3.ERRoadNetwork.CreateRoad (System.String roadName, EasyRoads3Dv3.ERRoadType roadType, UnityEngine.Vector3[] markers) (at <69cf1a9e593e4f2ca7976a517a06d72c>:0)

    It seems as if the CreateRoad() call fails.

    What can I do?

    Best... Matthias

    EDIT: I just found the old post from 2017 by Nordstroem that recommended to use the 2-parameter version of CreateRoad. And indeed, this works:

    Code (CSharp):
    1.         var road = network.CreateRoad("Highway", markers.ToArray());
    2.         ERRoadType roadType = network.GetRoadTypeByName("Default Road");
    3.         road.SetRoadType(roadType);
    4.  
     
    Last edited: May 25, 2019
  7. mattes3

    mattes3

    Joined:
    Apr 23, 2019
    Posts:
    15
    Hi,

    I've got a road with 250 markers.

    How can I create the road so that it has ERMarkerControlType.StraightXZ set for all the markers at the same time? If I call road.SetMarkerControlType() for all the markers in a for loop, this causes a massive performance hit.

    Cheers
    Matthias
     
  8. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Hi Raoul,

    I've read what you've been saying lately in the thread about the SRP and LWRP in particular, because I was thinking on starting my project in LWRP.
    I wanted to ask if there are any known issues in the current version (3.1.7.1) with the shaders/materials/etc packed with EasyRoads3d and the LWRP. Right now I only have the Road System, but will consider buying HD Roads package too.

    Kind regards.
     
    Last edited: May 25, 2019
  9. mattes3

    mattes3

    Joined:
    Apr 23, 2019
    Posts:
    15
    Hi,

    I've got a terrain that was generated with Gaia, and I generated the roads with API calls to EasyRoads 3D Pro. Which ER3D API do I need to call so that a tree is removed when it collides with a road (see image below)?

    Cheers...
    Matthias

    tree-collides-with-road.jpg
     
  10. raoul

    raoul

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

    Is this scripting API related? Usually you don't want to set all markers to this control type, that will not look to good.

    Indeed the road will auto Refresh after SetMarkerControlType() for each call. And overloaded version can be added, I will make a note of that. This will require a scripted Refresh()

    Thanks,
    Raoul
     
  11. raoul

    raoul

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

    ERRoadNetwork class:

    BuildRoadNetwork(bool splatmaps, bool trees, bool detail, ERRoad[] roads)
    BuildRoadNetwork(bool splatmaps, bool trees, bool detail)

    Thanks,
    Raoul
     
  12. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735

    Hi 40detectives,

    The EasyRoads3D Pro package itself does not include HDRP and LWRP specific shaders. The provided shaders are fairly simple, very similar tot the Unity standard shader but with offset options added. So the shaders that come with the srp versions or upgraded Unity standard shaders should also work.

    Including more shaders, also for HDRP and LWRP, is on the list but so far this is not often requested contrary to tool specific features like more crossing options so that is where the focus currently is. For shaders / materials you do not rely on the tool or what is built-in. Any material can be assigned to the roads, crossings and side objects.

    The shaders / materials in the HD Roads package are more advanced and do indeed include both HDRP and LWRP version. The HDRP version may result in errors in more recent HD RP versions. A fix for that is available, the package will be updated soon.

    Thanks,
    Raoul
     
  13. raoul

    raoul

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

    I missed this post yesterday.

    The 3-parameter version should work just fine. But which version are you using?

    The current version v3.1.7 on the asset store has a critical bug also affecting all CreateRoad() methods.

    v3.1.7.1, available on our website has a fix for that. It is pending approval on the asset store.

    Thanks,
    Raoul
     
  14. mattes3

    mattes3

    Joined:
    Apr 23, 2019
    Posts:
    15
    Hi Raoul,

    the 3-parameter version throws an exception, that's why I am using the 2-parameter version. My code currently looks like this:

    Code (CSharp):
    1. public void generateRoad() {
    2.     ERRoadNetwork network = new ERRoadNetwork();
    3.  
    4.     var markers = this.roadMarkers.ToArray();
    5.     var road = network.CreateRoad("My road", markers);
    6.     //for (int i = 0; i < markers.Length; i++) {
    7.     //    road.SetMarkerControlType(i, ERMarkerControlType.StraightXZ);
    8.     //}
    9.  
    10.     ERRoadType roadType = network.GetRoadTypeByName("Default Road");
    11.     road.SetRoadType(roadType);
    12.  
    13.     road.FollowTerrainContours(true);
    14.  
    15.     network.BuildRoadNetwork(false, true, false);
    16. }
    17.  
    When I use the 3-parameter version, the road is not created and I see this exception in the console window:

    NullReferenceException: Object reference not set to an instance of an object
    EasyRoads3Dv3.ERRoad.Refresh () (at <69cf1a9e593e4f2ca7976a517a06d72c>:0)
    EasyRoads3Dv3.ERRoad.SetWidth (System.Single width) (at <69cf1a9e593e4f2ca7976a517a06d72c>:0)
    EasyRoads3Dv3.ERRoadNetwork.CreateRoad (System.String roadName, EasyRoads3Dv3.ERRoadType roadType, UnityEngine.Vector3[] markers) (at <69cf1a9e593e4f2ca7976a517a06d72c>:0)

    The code that produces this exception looks like this:
    Code (CSharp):
    1. public void generateRoad() {
    2.     ERRoadNetwork network = new ERRoadNetwork();
    3.  
    4.     var markers = this.roadMarkers.ToArray();
    5.     ERRoadType roadType = network.GetRoadTypeByName("Default Road");
    6.     var road = network.CreateRoad("My road", roadType, markers);
    7.     //for (int i = 0; i < markers.Length; i++) {
    8.     //    road.SetMarkerControlType(i, ERMarkerControlType.StraightXZ);
    9.     //}
    10.  
    11.     road.FollowTerrainContours(true);
    12.  
    13.     network.BuildRoadNetwork(false, true, false);
    14. }
    15.  
    Could you make the 3-parameter version work, too, please?

    Thanks...
    Matthias
     
  15. raoul

    raoul

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

    In my previous post just above your last post I asked which version you are using?

    The 3 parameter version works fine unless you use v3.1.7. Earlier versions work well so does v3.1.7.1 on our website. The asset store update is pending approval.

    Thanks,
    Raoul
     
  16. vpamidi

    vpamidi

    Joined:
    Apr 18, 2019
    Posts:
    11
    Hi,

    I thought Laneindex will start from 1 so I gave condition as k = 1; k<= icount.
    Now I corrected it as k = 0; k < icount.

    Though icount =2 (two lanes), I am getting lanepoints only for one lane. The for loop is executing only once for value k=0. it is not executing when k=1.

    I tried by hardcoding laneindex value instead of using for loop in script. Then also For two lane road, I am getting data for below laneindex 0
    curr_road.GetLanePoints(0, curr_road.GetLaneData(0).direction)
    But not for laneindex 1
    curr_road.GetLanePoints(0, curr_road.GetLaneData(1).direction)

    Could you check if you are getting lanepoints for laneindex0 and 1 both for two lane road.

    Also, one more question Is there any method to get spline points and lane data of junctions?

    Thank You,
    Vijayalakshmi
     
  17. PhilipZ0

    PhilipZ0

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

    do you have a link to the manual or simple example of generating road via scripting API. I could not find a good starting point. My current use case is the generation of the infinity road by instantiating the road after the vehicle hits the middle box collider and deleting the road segment before after hitting the end of the segment.

    Currently I am using the free version of Easy Roads, but if this use case will be solved I would probably upgrade to Pro version since I am looking into recreating the highways etc.

    Great asset, cheers.
     
  18. raoul

    raoul

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

    When I tested your code last week using:

    for (int k = 0; k < icount; k++)

    The output was correct. It was tested on 1 x 1 lane road and a 2 x 2 lane road. The first returned two lanes one left and 1 right direction including the lane points. The second returned 2 x left and 2 x right direction including the lane points.

    In one of my posts (the one on this page at the top) I asked what your road looks like in the Unity editor when selected and when General Settings > Scene Settings > Display Lane data is active.

    Is the visible lane data in Scene View accurate?

    The v3.2 beta includes a runtime script example also covering lane data on crossings. Have you checked that?

    Thanks,
    Raoul
     
  19. raoul

    raoul

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

    The Pro version includes a simple runtime script example, a road will be created and afterwards an object follows the road.

    The easiest way is to work with a road object already available in the scene. That way road types etc. can be setup in the Unity editor. Creating a road at runtime will look like this:

    Code (csharp):
    1. // create reference to the road network object
    2. ERRoadNetwork roadNetwork = new ERRoadNetwork();
    3.  
    4. // get the road type
    5. ERRoadType roadType = roadNetwork.GetRoadTypeByName("motorway");
    6.  
    7. // create the road, markers is an array of Vector3 control points
    8. ERRoad road =  roadNetwork.CreateRoad("motorway 1", roadType, markers);
    9.  
    10. // Update the terrain heightmap, splatmap, trees and detail objects (if necessary)
    11. roadNetwork.BuildRoadNetwork(true, true, true);
    The last bit might be tricky for an infinite road or is no terrain involved? What type of game is this? Because the surrounding terrain could also be created using side objects.

    But the scripting API is not supported on the free version.

    Thanks,
    Raoul
     
  20. GreenDinoBV

    GreenDinoBV

    Joined:
    Oct 2, 2012
    Posts:
    3
    Hi Raoul,

    I have an issue with my materials once i connect roads to my connectors. Once I connect the roads to my custom connectors, weird shadows and highlights appear. Seems to happen to all the connectors. Is this a known issue? Or is there something I need to do?

    I tried to re-export everything from 3ds max and re-imported everything into Easyroads3D.
     

    Attached Files:

    • 1.png
      1.png
      File size:
      1.9 MB
      Views:
      507
    • 2.png
      2.png
      File size:
      2.1 MB
      Views:
      510
    • 3.png
      3.png
      File size:
      1.9 MB
      Views:
      510
    • 4.png
      4.png
      File size:
      2 MB
      Views:
      504
  21. MADUXX_INC

    MADUXX_INC

    Joined:
    Apr 8, 2015
    Posts:
    5
    were cul de sacs / dead ends ever implemented?
     
  22. raoul

    raoul

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

    That looks like an issue with averaging the normals between roads and the prefab connections. How do your models import in Unity? Was it necessary to change the "Trace On" axis in the Custom Prefab editor? Is it possible to have a look at one of these prefabs?

    Thanks,
    Raoul
     
  23. raoul

    raoul

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

    Cul de sacs / dead ends is not yet built-in, a prototype was done a while ago. I would have to check what the status of that is. At the moment the focus is on expanding the crossing options with the Flex Connector and motorway exits.

    Meanwhile cul de sacs can be done using the custom prefab system based on imported models. They will integrate in the system, roads can snap / connect to them.

    Thanks,
    Raoul
     
  24. Binary42

    Binary42

    Joined:
    Aug 15, 2013
    Posts:
    207
    Thanks for the offer. :)
    So i checked back on the Terain Coordinates and no mater what, the imported network becomes distorted to the active terrain. Despite your kind effort, i see no effect - the function of these coords still hasn't dawned on me. x)

    Here is my workflow:
    - grab some OSM from openstreetmap.org
    - also grab a matching height map from terrain.party (great resource btw.)
    - try to bring these two together
    - for that i need to calculate the dimensions of the exported OSM by its long/lat info.
    - Create a terain with that dimensions
    - import osm
    - edit height map to the OSM dimensions
    - apply height map to terrain
    - (and at this point i'd be happy if anyone could point me to a resource that exports OSM & matching height map :') )

    I find distorting the roadnetwork (while importing osm) to the terrain a unfortunate solution, why would you get real world data in the first place then?
    Respectively wich one should win? (And thanks again for the option to transform networks, it helped a great deal to fight this problem). As i see it, one can go Terrain-First, match osm to terrain, or OSM-First, match terrain to osm - what would be the usecase with a wider range, since that dataset has the higher resolution (outside the US with ~10m USGS NED data at least) and well, maybe one doesnt need a height map (or terrain) at all or the region is negligible flat anyway.
     
  25. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    The "offer" is intended to test your data and provide feedback specific to your situation :)

    DEM data usually comes with long / lat info. Have you tried using the downloaded DEM data directly on the terrain and set the terrain width / length to the matching DEM sizes? Enter this info in the Global Terrain Coordinates fields and simply import the OSM file. That is how we always work. It seems a different workflow then what you describe.

    Thanks,
    Raoul
     
    Last edited: May 28, 2019
  26. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    Hello, I just want to report some beta issues:
    - sidewalks don't work at all (I know, sidewalks are work in progress)
    - if you activate a flex connector, you have to change the road type of every road back and forth, otherwise the width doesn't work (you'll get a wide road with a narrow entrance to an either wide or narrow intersection)
    - sometimes while doing this, the selection get's stuck. You have to select something else (like the terrain), then the road network several times, before you can select an intersection again
     
  27. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hello Carpe-Denius,

    That is correct, sidewalks will get an upgrade in v3.2. Currently sidewalk are controlled through the sidewalk settings on crossings. In v3.2 there will be a new Sidewalks section in General Settings. Sidewalks can be activated both on crossings and roads individually. That is why sidewalks do not yet work on the Flex Connector in the current beta.

    How can this issue be reproduced? When turning a current X or T crossing into a Flex Connector, the Flex Connector should be based on the involved road types. When pulling out road from other roads, a flex connector should be inserted based on the road type of the already existing road.

    Does this happen after changing the road type for one of the Flex Connector connections? In what way does the selection get stuck? Is it impossible to deselect the Flex Connector? Do you get error messages in that case?

    Thank you for the feedback!
    Raoul
     
  28. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    Sidewalks:
    I was talking about the 3.2 beta, sidewalks give an error about a wrong index

    Flex intersections:
    Start with a 4 lane road (just a simple road with double the width), create an x crossing (it won't be connected to the selected road, you have to put it in the scene first). When you have connected it, you'll get a wide road and a narrow intersection. That's kind of expected since it isn't a flex connector yet.
    Drag the other three roads out. You can now convert it into a flex connector. If you change the new three roads into the wide road, you'll end up with 4 wide roads and a narrow intersection. This only get's updated when you select the flex connector. It will say that 3 of them are "choose road type" and one is "wide road".
    You have to switch the wide road one to something else and back to wide road, the connector updates (but still has issues).
    Those go away after you change the three "choose road type" connections to "wide road" and make sure that all connections have that "primary section" active. Now the intersection will update correctly.

    Here's a screenshot with two different outcomes (the pink one is a default road without hdrp material), both are flex connectors.

    upload_2019-5-29_0-46-11.png

    The stuck selection might come after changing road type in the intersection, yes. But I don't get any error Messages.
     
  29. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    243
    I've had similar issues trying to find real world map data, and I ended up using the Mapbox Unity plugin and writing my own code to generate the roads at runtime. I still need to work on intersections and joining those to the roads. I'm also using a custom dataset that has been annotated with intersections and additional data (e.g. road widths, surface type, etc). The unfortunate side-effect of this is that I have to regenerate the roads every time I run (due to licensing/limitations in Mapbox), but I do get to use the Mapbox API for runtime addition of features (it's recently come to my attention that I might be in danger of creating a very specific GIS type system).

    In any case, if you're interested in looking at that sort of solution, I'm more than happy to share my code.
     
  30. GreenDinoBV

    GreenDinoBV

    Joined:
    Oct 2, 2012
    Posts:
    3
    I import them as a FBX, and did not have to change the trace on axis in the Prefab editor. I can send you some prefabs. Where can i send them to?
     
  31. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Carpe-Denius,

    The sidewalk system currently in v3.2 is the v3.1 system. Because the sidewalks will be upgraded in the final v3.2 as well, the v3.1 sidewalk system is not integrated for the Flex Connector. It should not be used on roads also connected to the Flex Connector. The current sidewalk system should still work well on the v3.1 crossing options.

    The small v3.2 demo scene does show this. It is a combination of v3.1 crossings and Flex Connectors with AI lane data on both. The v3.1 crossings do have sidewalks.

    Double the width, is the width adjusted in the road properties overriding road type settings?

    In that case, it is very much recommended to work with road types. Please set the width for the specific road type because the Flex Connector will be based on the used road type.

    When a road type is assigned, the road width option in the road properties will be disabled in a future update.

    Is that indeed what is causing the issues?

    The other situation that can result in what is visible in the image is, when the road type of a road connected to a Flex Connector is changed. Currently this does not update the Flex Connector. The reason for that is that the intentions might be that a different road type should connect. Imagine an asphalt road, a damaged asphalt dirt road and a dirt road. For a specific Flex Connector on the asphalt road the connection should be the damaged asphalt road, but the road attached to this connection should be the dirt road, two different road types involved.If one of these road types is wider, the result will look like in your image.

    This last situation needs to be worked out so the Flex Connector will actually auto update to road type changes. An option can be to add multiple connection materials for the road type, in this case also the damaged asphalt dirt connection material for the dirt track. Then In the Flex Connector settings the desired connection material can be quickly adjusted.

    Thanks,
    Raoul
     
  32. raoul

    raoul

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

    In what way were you having issues? With the EasyRoads3D implementation?

    The only thing that may slightly affect the results when using different data sources is the projection of the data sources. Tools like globalmapper can help here. Or is that what Mapbox does?

    Thanks,
    Raoul
     
  33. raoul

    raoul

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

    You can start a Conversation here on the forum, and attach the models. Or send them by email, the email is in the readme file in the EasyRoads3D root directory.

    Thanks,
    Raoul
     
  34. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    The width is specified in the road type settings, I'm not using any of the width overrides.
     
  35. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Does that mean that the second part of my answer applies here? The road type assigned to the specific connection on the Flex Connector does not match the road type assigned to to the attached road? Because looking at the materials, the road types on the crossing does not seem to match the road type of the attached roads. Are the widths of these road types different?

    Thanks,
    Raoul
     
  36. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    I can't change the road type on the intersection until I converted it to a flex connector.

    So:
    - create x-crossing (no road type specifiable)
    - connect existing "wide road" road type to x-crossing
    - "wide road" becomes narrow, but still has "wide road" type selected
    - pull out the other three roads (all default narrow)
    - change all to wide road (the three pulled roads are now wide, the old wide one is still narrow)
    - change crossing to flex (you'll get an index out of range error)

    You'll end up with this:

    upload_2019-5-29_9-42-42.png

    You now have to change every road type on the intersection (all correctly marked as wide road) to something else and back to update and generate correctly
     
  37. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Yes, Isn't that what I mentioned, not matching road types?

    Option 1:

    General Settings > Road Types

    Select the wide road type and press the "Create New Connection Prefab" button below Connection Material. This will create a new crossing prefab based on the "wide road" settings including the Connection Material.

    Attach your wide road types to this crossing prefab and turn it into a Flex Connector.

    Option 2:

    Don't use the standard built-in crossings, instead, move the mouse over the road section where the Flex Connector should be inserted. Hold Shift, left mouse down, a blue sphere will appear when a Flex Conenctor can be inserted at that point. While holding Shift and mouse down, drag. A new road will be created and after releasing the mouse button a Flex Connector will be inserted.

    1. Add an instance of the Default X Crossing to the scene
    2. Pull Out roads from all four connections
    3. Change crossing to Flex Connector by toggling on the Flex Connector check box

    This all works without index out of range errors using the provided assets and presets. Do these steps also result in errors on your end or is this related to the specific "wide road" road type being connected to that crossing?

    Thanks,
    Raoul
     
  38. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    Option 1 works great, I thought I don't need a custom connection when the goal is to have a flex connection anyway.
    Option 2 works, too, without problems.

    Seems that I used the one broken workflow (if intended at all..) between 4 working ones. I don't get any errors that way. Thank you.
     
  39. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Turning a "regular" X or T crossing into a Flex Connector was the first thing added as this process will also be required for upgrading dynamic built-in crossings in v3.1 projects to v3.2 Flex Connectors. With that setup it is already expected that these dynamic crossings are setup to match the road type of the connected roads, option 1 in my previous post.

    I am still unsure about the error you got in the "broken" workflow which does work fine in the steps I posted. Did you try that? I also tested this on a v3.1 X crossing with two matching road types attached and two not matching road types. The crossing converts into a Flex Connector without errors.

    Thanks,
    Raoul
     
  40. vpamidi

    vpamidi

    Joined:
    Apr 18, 2019
    Posts:
    11
    Hi Raoul,

    Thank you. I am able to get lane points for all lanes of a road. I have General Settings > Scene Settings > Display Lane data as active.
    I am trying to get lanedata of junctions now. I have gone through v3.2 beta 1 Road Type Upgrade - Flex Connector video. I am not getting ER Lane connector(as 2.39 in video) window when I select flex connector. Also, In Flex connector settings, I don't see rebuild Lane connectors button. Instead I am able to see Reset Lane connectors button. When I press Reset Lane connectors button I don't see lane connectors(as 6.43 in video) shown in scene view for selected flex connector.

    I am using v3.2 b5 version of Easyroads3d.

    Also, could you let me know how can I get connectionIndex to call ERConnection.GetLaneData(int connectionindex)

    Thank You.
     
  41. raoul

    raoul

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

    Good to hear getting lane points from roads does work now.

    At 2.39 the Flex Connector is selected followed by changing the road types for some connections. I am not sure how ER Lane connector is involved here?

    "Rebuild Lane Connectors" is indeed renamed to "Reset Lane Connectors", meaning lane data will be generated for all possible lane connections. "Rebuild Lane Connector" sounds more like, the existing lane data will be rebuild which is not what this button does.

    This button should work. Have you tried this with the provided beta assets? Does that work?

    Do the Flex Connector connection road types match the connected roads? Or more specifically, do these road types actually have lane data info specified in General Settings > Road Types? Do you see these white handles with a rectangle indicating the start of a lane and the white handles without rectangle indicating the end of a lane. In that case, can you manually create lane connections like done in the video at 6.54?

    connectionindex is the index of that connection, referring to the connections labeled as "Road 1", "Road 2", etc. in the Inspector. Is that the question?

    Thanks,
    Raoul
     
  42. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    243
    Sorry, should have been more clear. Just issues in finding real world data that was easy to import into Unity and being able to map that onto terrain and also be able to import OSM data and transform coordinates to the right place on that terrain, without having to learn how to do the transforms myself. Mapbox takes care of all of that, with the downside that they don't allow you to generate Unity terrain (it uses a mesh), or view it in the editor. There are also limits to the free tier, but that won't impact my use case. One of the things I am trying to do is to allow users to interactively place things (trees, buildings, etc.) and share them, and I can use the Mapbox API/servers to do that without having to create my own infrastructure to do so. It's not technically difficult, but then I've got to deal with managing another cloud service...

    At some point I do want to figure out how to take a heightmap from e.g. terrain.party, create a Unity terrain with a known transformation and bolt that on to Mapbox for the datasets. That way I could generate my road system in the editor and manually tweak it. In the meantime it's an interesting project to create a procedural generation system that can use attributes in the raw data to control the road features.

    To sum up, no problems with EasyRoads3D. Any issues I do run into are purely my own. For me the difficult parts are the artistic things, primarily textures/shaders. The programmatic bits are much easier to deal with.
     
    raoul likes this.
  43. Binary42

    Binary42

    Joined:
    Aug 15, 2013
    Posts:
    207
    I understood that ;)
    So how do you import DEM data? Whats your workflow?
    With regard to your offer maybe a quick step by step will help. I can send you an OSM to test but you can show how its supposed to be done with any racing circut as my test data. It's a nice use case and i checked Silverstone for OSM Data completness, its avaliable for download below, use "raceway" as cutom Tag.

    Silverstone:
    https://www.openstreetmap.org/export#map=15/52.0712/-1.010
     
  44. Binary42

    Binary42

    Joined:
    Aug 15, 2013
    Posts:
    207
    I have been there too ... for the data handling side (location based streaming etc.) i found Go Map so far does a feature rich and good job. (And yes you are ^^)
     
  45. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Do you also have the DEM data for this area? This can be in any format as long as it includes the lon/lat coordinates.

    We ourselves use the floatgrid format. Importing the floatgrid file is part of our internal system, it will look at the grid count and size and create a matching terrain.

    Thanks,
    Raoul
     
  46. Binary42

    Binary42

    Joined:
    Aug 15, 2013
    Posts:
    207
    Nope no terrain.
     
  47. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    It does work without errors when I do it as you said. I get the index out of range error only sometimes while converting x-crossings with the wrong road type (it doesn't occur with the new connection prefab made for the wide road)
    It seems to occur while changing road type in the flex connection settings:

    Code (CSharp):
    1. ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    2.  
    3. Parameter name: index
    4. System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    5. System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    6. System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    7. EasyRoads3Dv3.QDDDQODDQDQDQDD.OQDOCQDOQC (System.Collections.Generic.List`1[System.Int32]& tris, System.Collections.Generic.List`1[UnityEngine.Vector3]& vecs, System.Collections.Generic.List`1[UnityEngine.Vector2]& uvs, System.Collections.Generic.List`1[T] vecsData, System.Collections.Generic.List`1[T] uvsData, System.Collections.Generic.List`1[T] priorityPointsMain, System.Collections.Generic.List`1[T] priorityPointsMainUVs, System.Collections.Generic.List`1[UnityEngine.Color]& colors, System.Collections.Generic.List`1[T] originalShapeVecs, System.Collections.Generic.List`1[System.Int32]& connInts, System.Int32 totalVecs, System.Collections.Generic.List`1[System.Int32]& secondPriorityInts, System.Boolean singleSectionFlag, EasyRoads3Dv3.ERConnectionSibling sibling) (at <5a923e59458f4b108619ccff3bca06d3>:0)
    8. EasyRoads3Dv3.QDDDQODDQDQDQDD.ODOOCQCDQC (System.Collections.Generic.List`1[T] priorityRoads, System.Collections.Generic.List`1[T] primaryRoads) (at <5a923e59458f4b108619ccff3bca06d3>:0)
    9. EasyRoads3Dv3.QDDDQODDQDQDQDD.OCCCDDDDDO () (at <5a923e59458f4b108619ccff3bca06d3>:0)
    10. EasyRoads3Dv3.ERCrossings.ODQCCDDOOQ () (at <5a923e59458f4b108619ccff3bca06d3>:0)
    11. EasyRoads3Dv3Editor.QDDDOODDODQDQDD.OnGUI (EasyRoads3Dv3.ERCrossings cScr, EasyRoads3Dv3.ERModularBase baseScript) (at <50cbb218d9ac441daf4665537b961b4b>:0)
    12. EasyRoads3Dv3Editor.OQQODQDOCC.OnInspectorGUI () (at <50cbb218d9ac441daf4665537b961b4b>:0)
    13. UnityEditor.UIElements.InspectorElement+<CreateIMGUIInspectorFromEditor>c__AnonStorey1.<>m__0 () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:445)
    14. UnityEditor.PopupCallbackInfo:SetEnumValueDelegate(Object, String[], Int32)
    15.  
     
  48. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    The terrain heights are not important?

    With only the osm data known, the terrain must be set to the bounds of the osm data.

    The terrain size matching the link of the silverstone area in your openstreetmap link is:

    Width: 4.609
    Length: 2.692

    This is based on the bounds near the top in the osm file:

    <bounds minlat="52.0591000" minlon="-1.0444000" maxlat="52.0833000" maxlon="-0.9770000"/>

    After updating the Unity terrain according these sizes and importing the osm file, the width / length proportions do indeed look correct. The area surrounding the race track looks pretty accurate. The track itself does not look exactly the same as on the openstreetmap page so I wonder if the data is complete.

    silverstone.jpg

    Generally I would think this is being used with DEM data with the terrain size already matching this DEM data. But if it would be useful to automate the above workflow, auto adjusting the terrain size to the osm data, it can be added as an option.

    Thanks,
    Raoul
     
  49. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Thank you for the further feedback.

    And that also happens when selecting for example this "wide road" road type. Or could it be related to perhaps selecting v3.1 road types not upgraded yet to the v3.2 beta road types? I will see anyway if this can be reproduced.

    Raoul
     
  50. Binary42

    Binary42

    Joined:
    Aug 15, 2013
    Posts:
    207
    Yes! Please :)
    (the track is tagged "raceway")
    Thanks