Search Unity

EasyRoads3D v3 - the upcoming new road system

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

  1. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    To what extend is this EasyRoads3D related? There aren't that many shaders, especially in the Pro package itself and they are fairly simple. Which packages / shaders do you have imported?

    Thanks,
    Raoul
     
  2. tanu1215

    tanu1215

    Joined:
    Feb 8, 2016
    Posts:
    6
    Hey Raoul,

    The odd thing is that I am also calling GetLanePoints() using 0 as my index and successfully getting the Vector3 points. That's exactly how I am generating those green lines for node links. When calling GetLaneData() through, 0 does not work, but I tested with a numbers from 1- 20 and it worked. Again, not sure what is causing this weird issue. It is working for my purposes regardless.

    https://i.imgur.com/vpejPy1.png here is what the connection looks like. I generated the main roads by first putting down the connection and then dragging from it with the green handles. Maybe this could be at the center of this issue?

    As you can see, for my roads, I only have two lanes setup https://i.imgur.com/mXkNrme.png

    Code (CSharp):
    1. var conn = road.GetConnectionAtStart(out var connectionIndex);
    2.  
    3.             if (conn == null) continue;
    4.  
    5.             var laneConnectors = conn.GetLaneData(connectionIndex, 1);
    6.  
    7.             if (laneConnectors.Length == 0) continue;
    This is the code I am using to get those points.
     
    Last edited: Sep 20, 2019
  3. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hi tanu1215,

    Auto creation of lane connectors on crossings depends on the settings in General Settings > AI Traffic. In any case "Reset Lane Connectors" in the Inspector for a selected crossing will rebuild the data and, looking at the lane connectors in the first image in your post, all data is available.

    With that setup, on our end your code returns 3 laneConnectors when lane index 0 is passed. This is correct, each single lane on a road has laneConnectors in 3 directions on the crossing. When passing index 1, zero laneConnectors are returned which also is correct because lane index 1 does not exist with this 1 x 1 lane road type setup.

    Code (csharp):
    1.  [MenuItem("EasyRoads3D/AI/Get Lane Connectors")]
    2.     public static void GetLaneConnectors()
    3.     {
    4.         ERRoad road = EREditor.GetSelectedRoad();
    5.  
    6.         int connectionIndex;
    7.         var conn = road.GetConnectionAtStart(out connectionIndex);
    8.  
    9.         var laneConnectors = conn.GetLaneData(connectionIndex, 0);
    10.  
    11.         Debug.Log(connectionIndex + " Length: " + laneConnectors.Length);
    12.     }
    What do you mean with number 1-20? Would it be possible to send us by email a simple example project including your code?

    Thanks,
    Raoul
     
  4. Temeos

    Temeos

    Joined:
    Mar 29, 2019
    Posts:
    8
    Hi Raoul,
    I have some questions reguarding the side objects for easy roads.

    To give you an Overview of what i am trying to do:
    I want the user to be able to toggle e.g. three different side objects for individual markers on a road which is created at runtime. The user is assigning/toggling side objects at runtime(no editor interaction involed)
    In this case: Lampposts, Traffic Cones and a Concrete Barrier. All these side objects are not active by default for all markers in the side object manager "default active state for each marker" is false.

    How am i trying to implement it and problems i encountered:
    1. Set initialy, in a function, 3 side objects for the road via this code on below after the road is created:
      Code (CSharp):
      1.  
      2.             //sideObjectList keeps these 3 sideobjects
      3.             foreach (var sideObjectName in sideObjectList)
      4.             {
      5.                 SideObject sideObject = roadNetwork.GetSideObjectByName(sideObjectName);              
      6.                 erRoad.SideObjectSetActive(sideObject, true);
      7.             }
    2. When the user toggles(eg. using keyboard) one of the sideobject via scripting api for a given markerIndex, i have tried the following options, with their own set of problems:
      • I get the name of sideObject and activate it like so:
        Code (CSharp):
        1.  
        2.                  SideObject sideObject = roadNetwork.GetSideObjectByName(selectedSideObjectName);        
        3.                 //activate side Objects for this marker
        4.                 erRoad.SideObjectMarkerSetActive(sideObject, markerIndex, true);
        5.                 erRoad.Refresh();
        6.  
        The problem with this -> it activates all 3 side objects for this specific marker, instead of the one selected by the user
      • After that, i have tried to disable the other two side objects, after enabling the selected one. Like so:
        Code (CSharp):
        1.  
        2. SideObject sideObject = roadNetwork.GetSideObjectByName(selectedSideObjectName);          
        3.                 //activate side Objects for this marker
        4.                 erRoad.SideObjectMarkerSetActive(sideObject, markerIndex, true);
        5.                 //disable other side objects
        6.                 foreach(var sideObjectName in sideObjectList)
        7.                 {
        8.                         if(sideObjectName!= selectedSideObjectName)
        9.                         {
        10.                             SideObject side = roadNetwork.GetSideObjectByName(sideObjectName);
        11.                             erRoad.SideObjectMarkerSetActive(side, markerIndex, false);
        12.                         }
        13.                 }
        14. erRoad.Refresh();
        15.  
        The problem with this -> nothing is activated. So all side objects are disabled
      • And if I just use this code on below (without refreshing the road (erRoad.Refresh()) then 2 of the side object are activated although only one of them is selected
      • Code (CSharp):
        1.  
        2.                  SideObject sideObject = roadNetwork.GetSideObjectByName(selectedSideObjectName);        
        3.                 //activate side Objects for this marker
        4.                 erRoad.SideObjectMarkerSetActive(sideObject, markerIndex, true);
        5.  
    So can you please help me how to toggle side objects for a selectedmarker via scripting api at runtime.

    Best regards,
    Temeos
     
    Last edited: Sep 20, 2019
  5. swnc

    swnc

    Joined:
    Aug 3, 2018
    Posts:
    33
    Hi Raoul,

    I also have a question for the side objects; In total, I have 90 side objects that I can see it listed on the ERSideObjectsLog.prefab. I am trying to call the lastly created side object via RoadNetwork.GetSideObjectByName(name); but unfortunately lastly created one is not visible in the scene. On the editor, I can select the lastly created side object for the road and see that it exists on the scene. Is there a limit for the number of side objects that can be called?

    Best,
    swnc
     
  6. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hi Temeos,

    Side object control through the scripting APOI was only added recently. There is /.was indeed an issue similar to what you describe. That was fixed although I am not sure if that is part of the currentversion. Are you using the latest version? I will send you an update anyway so you can test it. By the end of next week a new update will be available anyway.

    Thanks,
    Raoul
     
  7. swnc

    swnc

    Joined:
    Aug 3, 2018
    Posts:
    33
    Hi Raoul,

    I will be also interested in that update if you can send it to me:)

    Best,
    swnc
     
  8. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hi swnc,

    There is no side object limit. Do you have multiple scenes in the project and was the side object created in another scene?

    ERSideObjectsLog is indeed used to store all side objects in the project. That doesn't mean they are all available in all scenes. Indeed side object count can rise and when many scenes are involved you probably want to organize which side objects will be available in a scene. That is done in the Side Object Manager tab > "Add Project Side Objects" button. Can you check if the side object is visible there and selectable? If it is not selectable it would mean it is already available in the scene.

    Thanks,
    Raoul
     
  9. swnc

    swnc

    Joined:
    Aug 3, 2018
    Posts:
    33
    Hi Raoul,

    I only have one scene. I also organized the side objects via "Side Object Manager tab > "Add Project Side Objects" button" and the side object is visible but not selectable there so I can see that it is available for the project. I also debugged that I actually receive that side object via scripting API however it is not visible on the scene. It is really weird that I am trying to figure out what could be the problem. Upon on that, I have duplicated some side objects that I know that I can activate via scripting API but these duplicated ones are also not active on the scene. I am pretty lost here.

    Best,
    swnc
     
  10. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    What are the settings? How many side objects do you have in the scene? Is this scripting API related only, can you add them manually to road objects in the Inspector?

    Thanks,
    Raoul
     
  11. swnc

    swnc

    Joined:
    Aug 3, 2018
    Posts:
    33
    I have the all (more or less) side objects from the demo project and I added a couple (5) new ones and it is 90 side objects in total (they are not active in the scene but available in the project so i have no side object at run time when I try to activate the newly created side object via scriptin API). I just duplicated the "Beach Parasol" side object and tried to activate via scripting API but it did not work although I can activate the original "Beach Parasol" side object via scripting API. This is scripting API related, I can add them (newly created ones) manually via the Inspector. However, I can not see a reason why it shouldnt work. Can you maybe create more than 90 side objects and try to activate the last one via scripting api (last beta version I am using)?
    Code (CSharp):
    1.  
    2. SideObject so = roadNetwork.GetSideObjectByName("BeachParasol2");
    3. erRoad.SideObjectSetActive(so, true);
    Best,
    swnc
     
    Last edited: Sep 20, 2019
  12. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Ok, so this is scripting API related.

    Reading this and just to be sure, does any of the side objects work at runtime? What is your setup? Do you already have a road network object in the scene, inside the Unity editor or is the road network created at runtime? For side objects to work at runtime please use a road network that already exists in the scene including road types and side objects available for that road network. The same ERRoadNetwork constructor will create a reference to this road network.

    There is no side object limit. Can you delete a number of side objects so the total is well below 90. Do the duplicated side objects work now through the scripting API. Otherwise, can you email a project with this problem so we can look at it?

    Thanks,
    Raoul
     
  13. nmbileg

    nmbileg

    Joined:
    Sep 29, 2017
    Posts:
    14
    Hey Raoul! My road is generated on runtime using markers. How to connect the start and end of the road using script? I want to make it a looping road. Thanks in advance!
     
  14. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hi nmbileg,

    ERRoad.ClosedTrack(bool value) can be used for that.

    Thanks,
    Raoul
     
    nmbileg likes this.
  15. nmbileg

    nmbileg

    Joined:
    Sep 29, 2017
    Posts:
    14
    Works like a charm. You're awesome Raoul!
     
    raoul likes this.
  16. Noa3

    Noa3

    Joined:
    May 29, 2012
    Posts:
    71
    Hello dear Raoul,

    can you add support for adding crossings and street connecting in the editor via API?
    So the asset creator of Real World Terrian can create crossings and than streets in the editor.
    it would save a lot of working time for the owner of both assets.

    https://forum.infinity-code.com/viewtopic.php?pid=5595#p5595
     
  17. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hi Noa3,

    There have been requests like this before and we have been in touch with the developers of Real World Terrian. That is already possible,

    For example (from the manual):

    ----------------------------------------------------------------------------

    ERRoad class

    public ERConnection AttachToEnd(ERConnection sourceConnection, int connectionIndex)

    Instantiates and connects a new ERConnection object according the sourceConnection to the connection connectionIndex at the end of the road. Returns null in the case a connection is already connected to the end or when sourceConnection is not a valid connection object.

    public ERConnection AttachToStart(ERConnection sourceConnection, int connectionIndex)

    Instantiates and connects a new ERConnection object according the sourceConnection to the connection connectionIndex at the start of the road. Returns null in the case the new connection object could not be created because a connection is already connected to the start or when sourceConnection is not a valid connection object.

    public bool ConnectToEnd(ERConnection connectionObject, int connectionIndex)

    Connects the already exisiting ERConnection connectionObject to the connection connectionIndex at the end of the road. Returns false in the case a connection is already connected to the start or when connectionObject is not a valid connection object.

    public bool ConnectToStart(ERConnection connectionObject, int connectionIndex)

    Connects the already exisiting ERConnection connectionObject to the connection connectionIndex at the start of the road. Returns false in the case a connection is already connected to the start or when connectionObject is not a valid connection object.

    ----------------------------------------------------------------------------

    If there are limitations in how this is integrated in the scripting API we will be happy to look into that, but everything that is required is available. We ourselves are also looking into building this in the OSM and KML import options. I think perhaps the complexity of real world situation plays a role here, especially when providing a commercial tool and a reliable integrated solution.

    We had a crossings solution added in the very first releases, all good in standard situation like US city block type of environments. But real world situations can be a bit more complicated resulting in all sorts of complications when inserting crossings automatically. That is why it is not active yet.

    Thanks,
    Raoul
     
    Noa3 likes this.
  18. nbd

    nbd

    Joined:
    Aug 18, 2014
    Posts:
    34
    Raoul, can you please let me know your license requirements?

    thank you.
     
  19. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hi nbd,

    Is there anything specific you like to know? Unless things have changed I belief the asset store EULA is relevant here.

    Thanks,
    Raoul
     
  20. swnc

    swnc

    Joined:
    Aug 3, 2018
    Posts:
    33
    Hi Raoul,

    Are you considering to add one-way traffic direction alternative to left and right-hand traffic directions?

    Best,
    swnc
     
  21. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hi swnc,

    Yes, that will be added. For road types it will be a matter of marking all lanes as Right or Left depending on the driving direction. An option will be added to road instances in which direction it points as this may not necessarily mean from start marker to end marker.

    Thanks,
    Raoul
     
  22. swnc

    swnc

    Joined:
    Aug 3, 2018
    Posts:
    33
    Thank you, it sounds great.

    "For road types it will be a matter of marking all lanes as Right or Left depending on the driving direction."
    I have been trying to set/change lane index and lane direction for roads via scripting api at runtime however I realized that these parameters are updated(set to default) after every marker add operation. I am a bit confused about the laneindex parameter of the lanedata because I expected as if I have 2 lanes then i would set one of them lets say laneIndex = 0 and the other one is = 1. But this is not the case. You also mentioned in your post here:
    https://forum.unity.com/threads/eas...-new-road-system.229327/page-150#post-4967285 saying "connectionIndex is the connection where the road is attached to the crossing. Lane is the lane index which in your case is 0 because there is only one left and right lane."
    So if I have 3 lanes and the traffic direction is one way then to receive the lanedata information/points on the road object:
    Code (CSharp):
    1.  
    2. pointslane1 = erRoad.GetLanePoints(0, ERLaneDirection.Right);
    3. pointslane2 = erRoad.GetLanePoints(1, ERLaneDirection.Right);
    4. pointslane3 = erRoad.GetLanePoints(2, ERLaneDirection.Right);
    If the traffic direction is right hand then :

    Code (CSharp):
    1.  
    2. pointslane1 = erRoad.GetLanePoints(0, ERLaneDirection.Right);
    3. pointslane2 = erRoad.GetLanePoints(1, ERLaneDirection.Right);
    4. pointslane3 = erRoad.GetLanePoints(0, ERLaneDirection.Left);
    5.  
    6. //and/or
    7. pointslane1 = erRoad.GetLanePoints(0, ERLaneDirection.Right);
    8. pointslane2 = erRoad.GetLanePoints(0, ERLaneDirection.Left);
    9. pointslane3 = erRoad.GetLanePoints(1, ERLaneDirection.Left);
    ?

    I am assuming/hoping that I understood the logic behind. However, for me, it would be really helpful that if I can set these laneIndex and lane direction parameters at runtime and receive lane points based on that.

    Best,
    swnc
     
    Last edited: Sep 24, 2019
  23. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hi swnc,

    Yesterday I mentioned that full support for one direction will be added. It is not fully supported at the moment and it is not possible to set the Left / Right direction of a lane through the scripting API. That is done in the Unity Editor in General Settings > Road Types.

    To some extend it may work if you set all three lanes of the road type to Right for right-hand driving or Left for left-hand driving. If that already works then it will only work in the direction the road was generated from marker 0 to the end. So you have to take that into account when creating the roads. This is what I meant in my previous post. More needs to be added to make this more friendly so this will work in any direction regardless in which direction the road was created.

    Thanks,
    Raoul
     
    JamesWjRose and swnc like this.
  24. Devsagi

    Devsagi

    Joined:
    Sep 28, 2019
    Posts:
    3
    Hello raoul,

    I've been using EasyRoads for a few weeks now and am pleasantly surprised by the amount of features it provides.

    Sadly, I'm having two issues with it.

    I wanted to ask if there is another solution to the bug where textures seem stretched on long roads in the built version of the game. That even happens with the example assets you provide. Adding I-Connectors makes the road look less smooth and breaks closed tracks. Having to build and check roads after placing a new road isn't a very comfortable workflow either. Could you please look into this? Is there perhaps some sort of compression going on when building the game? Maybe there is a way to disable it?

    texturebugs.PNG

    Second, while editing roads, in my project the handle of the move tool is missing when editing the road nodes. It was visible at the start of the project, but now it's always invisible. I have all Gizmos turned on as far as I can see. Selecting any other objects displays the handle just fine. The Road Network is in edit mode.

    missinghandle.PNG

    Thank you in advance
     
  25. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hello Devsagi,

    Glad to hear you like the feature set.


    What you describe is probably related to floating point inaccuracies when this starts to happen further away along the road. In that case there are two solutions:

    1) Indeed use I Connectors just before this problem starts to occur. This will force the UVs to start back at 0. In what way does the road look less smooth? Since the road is split in multiple road sections, the "Closed Track" option is no longer relevant. In the new situation the two road sections that previously were the start and end of the road can be merged together by snapping them or by inserting another I Connector

    2) Check the Unity project settings and make sure to toggle off Vertex Compression for UV0 in Project Settings > Player Settings > Optimization

    It seems you activate the "Free Move"" handle, this happens when pressing the M key. To switch back to the default position handle, press the specific tab in the Unity editor transform toolbar or press the W key.

    http://unityterraintools.com/EasyRoads3D/v3/html/shortcuts.html

    Thanks,
    Raoul
     
    hopeful likes this.
  26. Devsagi

    Devsagi

    Joined:
    Sep 28, 2019
    Posts:
    3
    Hi raoul,

    the 2nd option solves the texture issue splendidly.

    Although this dirt road from the example scene wasn't affected by the issue, I want to provide it as an example of the I-Connector changing the road like I mentioned in the previous post. This can probably be readjusted by playing around with the nodes, but I wanted to avoid having to change around my roads after finding out their UV breaks in the built version of the game.

    iconnector.png

    You were also correct about my second problem, pressing W solved the issue. Which toolbar are you referring to? I had the move tool selected as I circled in my previous picture.

    Thank you again for your very helpful reply.
     
  27. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hi Devsagi,

    Glad to hear you got the floating point issue resolved.

    The I Connector in the image is at a marker position with a Circular section, the section on the right of the connector. The Circular section option at the start or end of a crossing was only added recently. Indeed it should also no longer result in errors for I Connectors. But I Connectors are more intended to be used with the default Spline Controller. Do you see issues with that too? I will make a notre though to see if this can be improved for Circular sections.

    This one at the left top
    toolbar.jpg

    Depending on the selected object the rotation and scale tool also work.

    Thanks,
    Raoul
     
    Last edited: Sep 28, 2019
  28. Devsagi

    Devsagi

    Joined:
    Sep 28, 2019
    Posts:
    3
    It really works better with most other roads. I found another example in the demo scene where it doesn't work as nicely, but maybe that's related to the bridge? Aside from the changing side objects you can see a pointy corner here:

    iconnectors2.png


    Yeah, that's what I tried to use and caused the initial confusion. You can see that the move tool was selected in my initial screenshot and I wasn't aware of the hotkey changing it to hide the arrow controls.

    Thanks and best regards
     
  29. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    If you select the marker on the left not visdible int he image, you will see it uses the Striaght XYZ controller type. The same here. The I Connector is more optimized to work with ther Spline Controller. If you select that the road shape will be smooth

    Yes side objects will by default start / stop at marker positions. This can be tweaked by setting the Start / End Offsets, even on the main Side Object itself. That way at least the lampposts can be repositioned. Apart from that it is a matter of placing these I Connectors, if you want to use them, at strategic positions.


    Yes, I see what you mean. I will check that, please use the W key meanwhile :)

    thanks,
    Raoul
     
  30. PrimusThe3rd

    PrimusThe3rd

    Joined:
    Jul 3, 2017
    Posts:
    19
    I'm building (extra) long roads (10km or more). No intersections involved, at the moment...and after some distance this annoying "texture" occur. If intersection is added it resoloves the problem. How can I only split the road, if no intersection is needed to avoid this issue? Will such bug be still present in the next updates?

    Best regards, Primus
     

    Attached Files:

    • bug1.jpg
      bug1.jpg
      File size:
      728.1 KB
      Views:
      43
  31. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hi PrimusThe3rd,

    Devsagi asked the same question yesterday just a few posts above. It is probably not really a bug here is a copy of my reply:

    What you describe is probably related to floating point inaccuracies when this starts to happen further away along the road. In that case there are two solutions:

    1) Use I Connectors just before this problem starts to occur. The I Connector option is available further below in the marker section in the Inspector.

    2) Check the Unity project settings and make sure to toggle off Vertex Compression for UV0 in Project Settings > Player Settings > Optimization

    Thanks,
    Raoul
     
    PrimusThe3rd likes this.
  32. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    v3.1.8.f3 is now available

    In v3.1.8.f2 a new small but useful feature was added (not announced here), marking most used connection prefabs so they are listed at the top for quick selection. This is especially useful when many prefabs are available in the project, like for instance in the HD Roads package. This did not work well yet for existing scenes, it does now. Note the star selection at the right in the below image.

    favourites.jpg

    Scripting API requests like control over side object start / end offsets, splitting roads and inserting crossings have been added.

    To avoid conflicts with new Unity hotkey H, the H hotkey for activating side object offset handles in the scene has been changed to Control + H

    Please visit our website for more release notes details.

    Thanks,
    Raoul
     
    Noa3 and Rowlan like this.
  33. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    877
    What I'd like more is a preview image of the assets :)
     
  34. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hi Rowlan,

    That was already possible through "Prefab Display" Slider also visible at the top in the image. In the most left state, like in the image, it shows the prefab names only. Moving the slider will start generating snapshots of the prefabs and display them in the desired thumbnail size. But for this type of prefab display the new feature does not work yet.

    Thanks,
    Raoul
     
    Rowlan likes this.
  35. Barikli

    Barikli

    Joined:
    Jul 24, 2017
    Posts:
    6
    Hi Raoul,

    i have created a custom intersection and this is what happened. they have the same material, but the intersection has more brightness. road.PNG
     
  36. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hi Barikli,

    Is the material on the roads indeed exactly the same as the one on the intersection? Is the lighting correct when rotating the connection on the x or z axis? Does this also happen when "Recalculate Normals" and "Recalculate Tangents" in the Custom Connection Editor window are checked?

    Could you include or send your intersection model to us so we can test it on our end?

    Thanks,
    Raoul
     
  37. nmbileg

    nmbileg

    Joined:
    Sep 29, 2017
    Posts:
    14
    Hello again, Raoul! I got another question :)

    My road is generated at runtime by a script and I have a terrain. The road network automatically makes a nice indent along the road. However, I'd like to make the road indent have a slope line from the side of the road to the terrain ground. As you can see in the picture. Is it possible? Thanks in advance! Screen Shot 2019-10-06 at 5.50.15 PM.png
     
  38. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hi nmbileg,

    That can be done by adjusting the "Surrounding" values.

    The default Surrounding values can be set in "General Settings > Scene Settings". Different values can then be set per road type in "General Settings > Road Types". And finally both the left and right surrounding values can be adjusted per road marker in the Marker sections of the selected road. The same for the Indent values.

    surrounding1.jpg
    surrounding2.jpg

    Thanks,
    Raoul
     
    nmbileg likes this.
  39. nmbileg

    nmbileg

    Joined:
    Sep 29, 2017
    Posts:
    14
    Thank you! It worked! just one more question from your quote:
    "And finally both the left and right surrounding values can be adjusted per road marker in the Marker sections of the selected road. The same for the Indent values."
    Can I set left and right indent, surrounding values through script?

    Update 1:
    ERRoad.SetIndent(float value, int index, ERRoadSide side) is not working. The indent value is only working when I change the Default Indent on Scene Settings.
     
    Last edited: Oct 6, 2019
  40. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Indeed ERRoad.SetIndent(float value, int index, ERRoadSide side) can be used for that.

    With regard to accurate terrain derformation, the passed value must be the same or larger then the minimum required indent value, the value in Scene Settings. Also, ERRoad.Refresh() is required afterwards to actually rebuild the road.

    Thanks,
    Raoul
     
    nmbileg likes this.
  41. nmbileg

    nmbileg

    Joined:
    Sep 29, 2017
    Posts:
    14
    After calling the Refresh function, it worked! Superb support as always. Thanks!
     
    raoul and hopeful like this.
  42. m85a

    m85a

    Joined:
    Oct 4, 2016
    Posts:
    7
    Hi Raoul.
    Is it possible to change the Default Indent parameter in SCENE SETTINGS. The default is 6, as soon as I tie the road to the terrane. I need 1.7.
     
  43. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hi m85a,

    The Indent values are locked to a specific minimum required value based on your terrain specs (terrain size vs heightmap resolution). This is necessary to guarantee the best possible results when matching the terrain shape with the road network based on the available terrain points in that area. What are your terrain settings?

    So in general, to lower the Indent value,the terrain size must be smaller (by using multiple terrain tiles) or the heightmap resolution must increase. Do you need these settings in general or only in some areas? There are more advanced workarounds using side objects to generate more detailed terrain mesh overlays.

    Thanks,
    Raoul
     
  44. m85a

    m85a

    Joined:
    Oct 4, 2016
    Posts:
    7
    Hi Raoul !!!
    Thank you very much!!!
    I got the desired result by dividing the terrane into several parts !!!
    I wish you success!!!!
     
    raoul likes this.
  45. m85a

    m85a

    Joined:
    Oct 4, 2016
    Posts:
    7
    Hi Raoul !!!
    Please answer how to set the default height of the road above the terrane. For example, I am loading data from an OSM file and I need the road to be 1 meter above the terrain! ???
     
  46. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Hi m85a,

    1 meter above the terrain, what will that look like? Or should the terrain still be adjusted according the road shape but also raised 1 meter higher? Something like in the image a couple of posts above.

    Thanks,
    Raoul
     
  47. m85a

    m85a

    Joined:
    Oct 4, 2016
    Posts:
    7
    1.jpg 2.jpg 3.jpg

    I set the parameter along the Y axis to 1 manually.
     
  48. m85a

    m85a

    Joined:
    Oct 4, 2016
    Posts:
    7
  49. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,667
    Ok, so what is required is that the marker positions are raised one meter above the terrain.

    After the OSM import the marker positions will be at the terrain height. Do you do coding? The scripting API can be used to raise all markers one meter.

    Code (csharp):
    1. // create a reference to the road network in the scene
    2. ERRoadNetwork roadNetwork = new ERRoadNetwork();
    3.  
    4. // get all the roads
    5. ERRoad[] roads = roadNetwork.GetRoads();
    6.  
    7. foreach(ERRoad road in roads)
    8. {
    9.        Vector3[] positions = road.GetMarkerPositions();
    10.        for(int i = 0; i <  positions.Length; i++)
    11.        {
    12.               positions[i].y += 1;
    13.        }
    14.        road.SetMarkerPositions(positions);
    15. }
    Thanks,
    Raoul
     
    hopeful likes this.
  50. embeee

    embeee

    Joined:
    Aug 25, 2017
    Posts:
    6
    Hi, many thanks for a great asset. I'm having an issue with indents and terrain resolutions. I have a big map and want to give the distant terrain tiles a very low resolution/heightmap, and a high resolution for the tiles that actually contain roads. That way I can improve FPS since the player will only see the surrounding terrain from a far distance. However, EasyRoads3D tells me it's going to use the smallest terrain resolution to determine the indents, which then become way too big (171 instead of for example 5 or 3 which is what I need). Is there a way to override this, so that it will only use the resolutions of terrain tiles that have roads on them and ignore the other lower-res tiles?