Search Unity

World Building EasyRoads3D v3 - the upcoming new road system

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

  1. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    EasyRoads3D is not a terrain editing tool so there is no built-in option for that. Does Gaia offer this?

    Otherwise you can try something like this:

    Code (csharp):
    1.  
    2. [MenuItem("EasyRoads3D/Terrain/Set Terrain Height")]
    3.     public static void SetTerrainHeight()
    4.     {
    5.         Terrain terrain = Terrain.activeTerrain;
    6.  
    7.         float height = terrain.terrainData.size.y;
    8.  
    9.         // the new height
    10.         float newHeight = 1000;
    11.  
    12.         float factor = height / newHeight;
    13.  
    14.         int twidth = terrain.terrainData.heightmapWidth;
    15.         int theight = terrain.terrainData.heightmapHeight;
    16.  
    17.         float[,] heights = terrain.terrainData.GetHeights(0, 0, twidth, theight);
    18.  
    19.         for (int i = 0; i < twidth; i++)
    20.         {
    21.             for (int j = 0; j < theight; j++)
    22.             {
    23.                 float h = heights[j, i];
    24.                 h *= factor;
    25.                 heights[j, i] = h;
    26.             }
    27.         }
    28.  
    29.         terrain.terrainData.SetHeights(0, 0, heights);
    30.         Vector3 size = terrain.terrainData.size;
    31.         size.y = newHeight;
    32.         terrain.terrainData.size = size;
    33.         terrain.Flush();
    34.  
    35.         Debug.Log("Done");
    36.     }
    This assumes there is only one terrain in the scene so the terrain that has to be updated is also referenced by Terrain.activeTerrain. The new height is hard coded, currently set to 1000.

    Please backup your terrain first by duplicating it in the project folder.

    Thanks,
    Raoul
     
    Last edited: Jul 9, 2020
  2. BettoSan

    BettoSan

    Joined:
    Dec 7, 2017
    Posts:
    57
    This goes beyond what I know.
     
  3. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Can you drop the attached file in /Assets/EasyRoads3D/Editor/

    It will add a new menu item: EasyRoads3D/Terrain/Set Terrain Height

    The new max terrain height set in the script is 1000, this leaves another 400 based on your current highest point of 600. You can change the 1000 if you want.

    So assuming you only have one terrain in your scene all that is required is backup this terrain in the project folder and run this script from the main Unity menu.

    Thanks,
    Raoul
     

    Attached Files:

  4. qpuilie

    qpuilie

    Joined:
    Jan 14, 2020
    Posts:
    69
    Hello raoul,

    I have a question about connection,
    I want to connect a road to an intersection, but call the "GetConnectionWorldPosition" function, the returned world coordinates are wrong. I have drawn them. This is my code and situation, can you help me?

    Thanks,
    Zhang
     

    Attached Files:

    Last edited: Jul 10, 2020
  5. raoul

    raoul

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

    [Edit]

    It is a little bit hard to give exact feedback because your code is in an image.

    In Start() can you try:

    ERConnection connectionInstance = road.InsertConnector(...);

    and in CreateSecondRoad() try:

    connectionInstance.GetConnectionWorldPositions()

    Does that work better?

    Thanks,
    Raoul
     
    Last edited: Jul 10, 2020
  6. PrimusThe3rd

    PrimusThe3rd

    Joined:
    Jul 3, 2017
    Posts:
    69
    Hi,
    how do we get (make) some poly style roads? I would like something similar like attached photo. There is already visible thickness I would like to have (even for all default roads integrated in EasyRoads3D). Best regards.
     

    Attached Files:

  7. raoul

    raoul

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

    There are three ways to do that:

    1) in v3.1 default roads are flat, but you can import your own road shapes through the Custom Connection System based on your own models, https://easyroads3d.com/tutorials/custom_crossings.php. That can be a road section with thickness but also a crossing with thickness. Connected roads will inherit the same shape.

    2) If no crossings are involved then this can be done quickly using the Shape type of side object. The road shape with thickness is defined in the Shape Editor window. In General Settings > Road Types a new road type can be created marked as "Is Side Object" with this specific road type switched on. That way no default road will be created, instead the the road with thickness will be created. With this setup it is easy to quickly create new roads of this type.

    In your image the terrain is flat, so I it looks like the above will already work. But additionally it is also possible to adjust the terrain by using another shape type of side object marked as a Terrain Deformation object. That way the terrain can be adjusted in the same way as for "standard" roads. Something similar is done to create the river bed in the demo package.

    3) V3.3, available in alpha builds on our website, does have built-in support for roads with thickness. The shape can be set in General Settings > Road Types. Also, the Flex Connector also available in v3.3 does support custom road shapes. The second video on this page https://www.easyroads3d.com/v3alpha.php shows an example of built-in custom roads shapes.

    Best regards,
    Raoul
     
    PrimusThe3rd likes this.
  8. PrimusThe3rd

    PrimusThe3rd

    Joined:
    Jul 3, 2017
    Posts:
    69
    Thank you.
    Since no crossings are involved I'm looking for a quick solution. :)

    Best regards,
    Primus
     
  9. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Ok :) If you want hard edges like in your image, the v3.2 beta does support that for Shape type of side objects. The v3.2 beta is part of the asset store download as a separate package. This feature should be stable.

    Thanks,
    Raoul
     
  10. qpuilie

    qpuilie

    Joined:
    Jan 14, 2020
    Posts:
    69
    Thank you,i know what the problem is.
     
    raoul likes this.
  11. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    Hello
    Every time I start the Unity editor and click ROAD NETWORK there is a break that lasts around 5 minutes.
    When, in the editor, I press play, then I stop it and click ROAD NETWORK again, that stop occurs again. Less duration, but also tedious.
    I have everything updated and my computer is powerful.
    It is very maddening because it paralyzes work for a long time.
    Any ideas?
    Thank you.

    PD Only has a road in scene with 1.75 km.
     
  12. raoul

    raoul

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

    I understand such a long delay is unworkable but the road network should be responsive immediately after selecting it. There is no history of such long delays in recent versions. Which version do you use?

    What does this road look like? Are side objects involved? Is there still a delay after removing the road?

    If you want you can email us the scene so we can look at it.

    Thanks,
    Raoul
     
    Last edited: Jul 15, 2020
  13. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374

    Unity 2019.4.1f
    EasyRoad v3.1.9f5

    Last test (now)

    - Open Unity Editor.
    - Click on ROAD NETWORK
    - 12 minutes (with clock)

    - Change 1 marker and save.
    - Build road.
    - Press play button
    - Stop
    - Click on ROAD NETWORK
    - 6 minutes (with clock)

    - Change 1 marker and save
    - Build road.
    - Click on ROAD NETWORK
    - No Problem.

    - Press play button
    - Stop
    - Click on ROAD NETWORK
    - 7 minutes (with clock)
     
  14. raoul

    raoul

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

    Unity 2019.4.1f

    New project > Import EasyRoads3D v3.1.9f5 from the asset store

    /Assets/EasyRoads3D scenes/scene main

    I selected the Road Network object, the Inspector instantly updated fully responsive

    Then I created a new scene and added a road network object, the same results.

    In early versions pre Unity 2018.3 there was some code running to deal with an issue in Unity. Depending on the number of dynamic and custom connection prefabs in the project this could cause a short delay when selecting the road network object the first time after opening a scene. This is no longer the case after Unity 2018.3.

    What you describe is not standard behaviour, there is no recent history of this, it is hard to give feedback on it with the current info. Is this an empty project or do you have other assets imported? If not, can you try a new project with only EasyRoads3D imported. How does that work?

    Or can you email the project so we can test your setup on our end?

    Thanks,
    Raoul
     
    Last edited: Jul 16, 2020
  15. qpuilie

    qpuilie

    Joined:
    Jan 14, 2020
    Posts:
    69
    Hello raoul,
    We encountered a problem and would like to seek your help.
    We want to create some roads that are close to right angles, Even if the Markers I specified form a right angle, they do not get the desired effect.
    We did not find an API for setting the angle in the ERRoad API documentation
    If you can help me, I will be very grateful
    Thanks,
    Zhang
     

    Attached Files:

  16. raoul

    raoul

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

    The default controller type is the Spline Controller, this results in the shape on the left in your image.

    The Controller type option is available near the top in the marker section. The Circular Controller type is what you want to use to achieve the right hand road shape in your image. The radius can be controlled by the positioning of the markers at the start and end of the turn. Please try this manually in Scene View.



    Then using this through the scripting API is a matter of positioning these markers and set the controller type of the marker at the start of the turn to circular:

    road.SetMarkerControlType(markerIndex, ERMarkerControlType.Circular);

    Thanks,
    Raoul
     
  17. BettoSan

    BettoSan

    Joined:
    Dec 7, 2017
    Posts:
    57
    It worked really well
     
    raoul likes this.
  18. karaokefreak

    karaokefreak

    Joined:
    Nov 12, 2013
    Posts:
    96
    Hi
    Short question: Does the main tool or the mesh add on support tunnel building? I don't mean tunnels in the terrain (I guess that is impossible, though it would be nice). I just want to create a city with some spectacular tunnels , which means that I want to make loops that have streets go below and above one another.
    The screenshot shows what I mean. I made this in Blender, and of course, I can also model my own tunnel in Blender, but
    a) it would be easier if your tool helped me with this
    b) when creating the streets, they need to be on seperate levels, too, while still looking realistic (so not floating in the air)

     
  19. qpuilie

    qpuilie

    Joined:
    Jan 14, 2020
    Posts:
    69
    That's what I want,thank you,raoul.
     
    raoul likes this.
  20. raoul

    raoul

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

    a) Unity 2019.3+ supports holes in the terrain. Full tunnel support is coming in EasyRoads3D v3.2, https://easyroads3d.com/v3beta.php

    tunnelSelection.jpg

    v3.2 is available in betas, the package is part of the EasyRoads3D Pro download from the Asset Store. It includes tunnel examples based on two tunnel models in the project folder.

    The setup of the tunnel in the image can be used as a reference how you can make your own blender tunnels and integrate them in the tool as a side object.

    In v3.2 side objects like tunnels can be auto generated based on the terrain profile. In your situation it will be a matter of activating the tunnel side object for the marker sections where you want the tunnel.

    b) That too can be done as overpasses using the same side object system. Next step would be overpasses with exit ramps, That can be done using the Custom Connection Prefab system, intersections / connections based on your own imported models. So you can make these ramp sections in blender and import them in the system. Attached roads will inherit the same shape. This will be a built-in option in v3.3.x

    Thanks,
    Raoul
     
    Last edited: Jul 17, 2020
    combatsheep and karaokefreak like this.
  21. keithsoulasa

    keithsoulasa

    Joined:
    Feb 15, 2012
    Posts:
    2,126
    I'm running into an issue where when I try to hold shift and click road markers, Unity will just select the terrain.

    Any idea why this happens ?

    Nevermind, found the solution in this thread, reset the window layout to factory defaults .
    Please add a note inside of the editor window, I've wasted so much time on this bug
     
    Last edited: Jul 18, 2020
  22. raoul

    raoul

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

    It looks like you ran into an issue that can happen in recent Unity versions. It is covered on the Troubleshooting pages in the manual:

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

    Shift + Click to add road markers does not work, instead the terrain is selected

    The free version does not support multiple terrain tiles in a scene. If this is the case then adding markers will fail when adding them on the terrain that is currently not referenced by Terrain.activeTerrain.

    Another known situation in recent Unity versions is a, usually customized, Unity editor layout that have become corrupted not capturing keyboard or mouse button events in OnSceneView(). Instead the clicked object is selected, the terrain in this case. One way to verify this is to duplicate the project and reset the Unity editor layout back to one of the presets through the main menu > Window > Layouts. Afterwards the editor can be customized again to the preferred layout, this usually works well. But if the problem returns and can be recreated, then please contact us. We have discussed this with the Unity QA Team, they have seen this situation and they will be very interested to hear how this issue can be recreated.

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

    Please let me know if this does not solve the problem.

    Thanks,
    Raoul
     
  23. qpuilie

    qpuilie

    Joined:
    Jan 14, 2020
    Posts:
    69
    Hello raoul,

    I want to know that when I inserted a Connector, the second road that was separated did not have a gameObject, which caused me to call the GetRoadByGameObject method to get the object of the road.

    My Code:
    Code (CSharp):
    1. ERConnection erConnection= _roadNetwork.GetSourceConnectionByName(TcrossName);
    2.         _crossConnection= road.InsertConnector(erConnection, 1, 0, 1, out ERRoad road2);
    The road2's name in hierarchy is "road0_2",but it's gameobject is null.

    Ps:I build roads use the runtime api.

    Thanks,
    Zhang
     
  24. raoul

    raoul

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

    Thank you for reporting this, it has been fixed for the next update.

    Is this stopping you, do you need an update?

    Thanks,
    Raoul
     
  25. keithsoulasa

    keithsoulasa

    Joined:
    Feb 15, 2012
    Posts:
    2,126
    I've installed the beta, how do I create tunnels ?
     
  26. raoul

    raoul

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

    Two tunnel side object examples are included in the beta package, they are available in the Bridges / Tunnels tab in the Side Object Manager.

    The setup of these tunnel side objects is that they are auto generated based on rules defined in the Side Object Manager. The only thing requirement is that these side object are activated for the specific road objects. The tunnels will be auto generated when the terrain is higher then road height plus the Terrain Threshold Height value set in the Side Object Manager.

    The beta package includes a demo scene in /Assets/EasyRoads3D scenes/ with two roads and various side objects using the new v3.2 features. This scene can be reviewed

    More v3.2 info can be found here, https://easyroads3d.com/v3beta.php

    Let me know if you have further questions.

    Thanks,
    Raoul
     
  27. FurkanYasar41

    FurkanYasar41

    Joined:
    Jan 3, 2019
    Posts:
    5
    what is this problem here ? Screenshot_4.png
     
  28. raoul

    raoul

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

    Could you please check the terrain object(s) in your scene.

    The error is known and will throw a proper warning in the next update, but it appears there is a terrain object in the scene with missing texture layers, or layers with no textures. Is that indeed the case?

    Thanks,
    Raoul
     
  29. FurkanYasar41

    FurkanYasar41

    Joined:
    Jan 3, 2019
    Posts:
    5
    Thank you fixed problem :) [missing texture layers]
     
    raoul likes this.
  30. keithsoulasa

    keithsoulasa

    Joined:
    Feb 15, 2012
    Posts:
    2,126
    Still not having any luck with creating a tunnel. To be clear, this is going to deform the Terran, drill the hole, for me ?
     
  31. raoul

    raoul

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

    This is beta and needs to be further optimized also regarding different terrain heightmapscales (terrain size versus resolution) but yes, you should see holes in the terrain where the tunnel enters and leaves the terrain. By the end of next week a new beta will be available which includes tunnel optimizations.

    Is this only about cutting the hole in the terrain? Is the tunnel itself created? What are the exact steps you take? Does this work well in the demo scene I mentioned? Are you using Unity 2019.3+?

    Thanks,
    Raoul
     
  32. qpuilie

    qpuilie

    Joined:
    Jan 14, 2020
    Posts:
    69
    At present, I have solved it by:
    Code (CSharp):
    1. ERConnection erConnection= _roadNetwork.GetSourceConnectionByName(TcrossName);
    2. _crossConnection= road.InsertConnector(erConnection, 1, 0, 1, out ERRoad road2);
    3. road2.gameObject = road2.roadScript.gameObject;
    Thanks,
    Zhang
     
  33. raoul

    raoul

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

    Yes, I thought it was not really a critical problem, that is why I was asking if you need an update soon.

    Thanks,
    Raoul
     
  34. qpuilie

    qpuilie

    Joined:
    Jan 14, 2020
    Posts:
    69
    Hello raoul,
    I have a question about road splicing at runtime,
    The situation is as follows:
    I have two roads, A and B.
    I used B to connect the tail of A and got a new road C with 3 Markers.
    But when I drag Marker3 and use GetDistance(1) on the C, the result is indeed not a fixed value, it is more like the result of GetDistance(2) (Figure 1).

    If you know why, please help me.

    Best Wishes,
    Zhang
     

    Attached Files:

  35. raoul

    raoul

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

    What are the exact steps to reproduce this?

    Do you mean there are two roads A and B, both having 2 markers. Then road B is snapped to the end of road A resulting in road C with 3 markers?

    When I do that manually, GetDistance(1) returns the correct distance, the same distance visible in the Inspector when marker 2 is selected. And after dragging marker 3, GetDistance(1) does return the new distance for the marker 2 section.

    Thanks,
    Raoul
     
  36. qpuilie

    qpuilie

    Joined:
    Jan 14, 2020
    Posts:
    69
    Hi,
    1.I have two roads
    2.I call ConnectRoads to connect two roads
    Code:
    Code (CSharp):
    1. _road=_roadNetwork.ConnectRoads(interRoad, interRoad.GetMarkerCount()-1, _road, 0);
    3.Now,the new roads has three Markers
    4.I use the following code to output Distance::
    Code (CSharp):
    1. Debug.Log($"currentRoadMarkerCount:{markerCount} totalDistance:{_currentRoad.GetDistance()} Marker0({_currentRoad.GetDistance(0)}) Marker1:({_currentRoad.GetDistance(1)}) Marker2:({_currentRoad.GetDistance(2)})");
    Got the following results:
    Code (CSharp):
    1. currentRoadMarkerCount:3 totalDistance:71.381 Marker0(63.62265) Marker1:(7.758343) Marker2:(0)
    What I am more confused about is that in the Editor, two roads are connected, there seems to be 4 Markers, but I use runtime api to connect two roads, only 3 Markers
     
  37. raoul

    raoul

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

    When doing this through the scripting API, two roads both having two markers, ConnectRoads() results in a road with 4 markers. In your code the last marker of interRoad should connect to the first marker of _road, resulting in a 4 marker road.

    I just tested this:

    Code (csharp):
    1. currentRoadMarkerCount: 4 totalDistance: 134.2653 Marker0 (33.9871) Marker1 (32.25289) Marker2 (68.02533) Marker3 (0)
    Only the distance at the end section (marker3) is 0, which is the last marker so the distance will indeed be 0 for a non closed track.

    Usually this will be the other way around. How are you connecting two roads in the Editor? Generally this is done by dragging and snapping markers together. Since two markers will be at the same position one of the markers is removed. So two roads with two markers will result in one road with three markers.

    But another way to connect two roads in the editor works similar as ConnectRoads() using the scripting API, select the two markers that should be connected followed by SHIFT + J. This will result in a 4 marker road.

    Thanks,
    Raoul
     
  38. qpuilie

    qpuilie

    Joined:
    Jan 14, 2020
    Posts:
    69
    It turns out like this,
    public float GetDistance(int markerIndex) should the description be, "the distance from the current marker to the next marker"
    I understand that from the starting position of the road to the current markerd...

    Thank you very much,
    Zhang
     
  39. raoul

    raoul

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

    Yes, GetDistance(int markerIndex) returns the distance of the specific road section starting at markerIndex, from the manual: "Returns the distance of the section at markerIndex". It is the same value visible in the Inspector after selecting the marker.

    Thanks,
    Raoul
     
  40. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Having some issues with the latest Beta on Unity 2019.4.1f1 with roundabouts not connecting up to the roads. Any ideas?

    Actually, having the same issue with version v3.1.9f5 - they do not connect up.
     
    Last edited: Jul 21, 2020
  41. raoul

    raoul

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

    I just did a quick test with the provided roundabout prefab in the v3.2 beta package. Roads can connect.

    In what way do they not connect on your end? Are the handles red when trying to connect a road?

    In that case, is the road you want to connect a built-in road type with two nodes? Is the sidewalk status on the roundabout the same as on the road?

    Thanks,
    Raoul
     
  42. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Hi, Raoul - thanks for the quick reply. Yes, the handles are red on the roundabout.. I tried this with an X crossing and a T crossing, they connect up fine. Could be the sidewalk as I only had this on the roundabout. I'll give it another go.
     
  43. qpuilie

    qpuilie

    Joined:
    Jan 14, 2020
    Posts:
    69
    Hello raoul,
    I want to adress a quesstion in runtime api:
    Code (CSharp):
    1. public void AddMarker(Vector3 position)
    Should it return MarkerIndex?

    I call
    Code (CSharp):
    1. int index =  road.roadScript.ODQDDDCQCQ(position);
    and got the correct index.



    Thanks,
    Zhang
     
    Last edited: Jul 21, 2020
  44. karaokefreak

    karaokefreak

    Joined:
    Nov 12, 2013
    Posts:
    96
    Hi raoul.

    Sorry for bugging you again, I am no pro in unity, so I have to work my way into things. I have been working a little with your Asset and I think it is great. It is a great time saver! I am still a bit confused, though.

    1) Maybe I am blind or something, but I haven't found documentation on how to import my own street models into your system. I also need to know what preferences they need (which size they need to be, where it is best to subdivide them and so on, so they can easily bend and stretch)

    2) I wanted to ask if your mesh builder tool (which I haven't bought yet) supports making Intersections and crossings. I think that would make things easier for me, since I need 4 lane roads (2 x 2 lanes) for my city center. I have tried using your highway prefab, but there are no intersections that seem to fit in terms of design. So either I model my own type of street in Blender, or I use your mesh builder.

    3) oh, and by the way, I think I found two bugs:
    a) for some reason the river building tool doesn't work with my terrain. It only sets the starting point, but nothing else. Any idea why that could be? I use Terrain Composer 2, maybe it's some kind of incompatibility.

    b) when changing the size (width) of the bridge prefab, the bridge suddenly loses all textures and appears pink.

    thanks for your support
     
  45. raoul

    raoul

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

    In that case, can you select the roundabout and press the green outer handles of the roundabout connection where you want to attach the road. That will deactivate sidewalks for that connection, the connection an road shape will match and the road can connect. Afterwards these handles can be clicked again, by doing that sidewalks will also be generated on the attached road.

    Thanks,
    Raoul
     
  46. raoul

    raoul

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

    Is that a request? It can certainly be added.

    Thanks,
    Raoul
     
  47. raoul

    raoul

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

    In what way do you want to import your own street models? In a way that it is repeated along the road shape? That is at the moment not possible because of the complexity to connect these models with crossings.

    But if no crossings are involved, then this can be done by generating the roads as a Procedural side object type which will repeat the source prefab, your model, along the road shape.

    Which Mesh Builder tool is that? What is part of EasyRoads3D is the option to import your own connection models into the system, for example more complex 2 x 2 intersections. They will act as built-in intresections, roads can connect.

    a) Could you provide exact steps what you do? Do you see error messages in the console? The river option in the demo package is based on two side objects, a river surface and a river bed that is used to create the river shape in the terrain. Are these objects generated correctly?

    b) Which bridge prefab is that and how are you changing the width? For example, the Simple Bridge side object has "Adjust To Road Width" toggled on in the Mesh Editor Window. It should auto adjust to the used road type.

    Thanks,
    Raoul
     
  48. qpuilie

    qpuilie

    Joined:
    Jan 14, 2020
    Posts:
    69
    Hello raoul,

    Sorry to trouble you again,Now I have a problem:
    I want to connect to the middle of a road, so we need to add a Marker to a road, and then insert Connection.
    But now I cannot get the index after inserting the Marker,
    So I use AddMarker(Vector3 pos) to add a Marker and get the index.
    But it can only be successfully called once, when I call it the second time, the Marker is not inserted, MarkerIndex=-1.

    Now my question is:
    1. How can I insert a Marker in a road with multiple Markers, and then get MarkerIndex

    MyCode:
    Code (CSharp):
    1. int markerIndex=  road.roadScript.ODQDDDCQCQ(position);
    2. Debug.Log($"roadMarkerCount:"+road.GetMarkerCount()+" MarkerIndex:"+markerIndex);
    3. road.Refresh();
    4. ERConnection erConnection= _roadNetwork.GetSourceConnectionByName(TcrossName);
    5. _crossConnection= road.InsertConnector(erConnection, 1, 0, 1, out ERRoad road2);
    6. road2.gameObject = road2.roadScript.gameObject;
    Thanks,
    Zhang
     
  49. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    yes! I found a video before you replied. Thanks. Didn't realise that you take the roads out from the Roundabout, and not the other way around, then attach a road to it. Awesome - keep up the good work on this asset, much needed and a time saver!
     
  50. raoul

    raoul

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

    You are using non API code, I cannot comment on that.

    From the manual:
    If you insert a marker before marker index 5, the marker index of the inserted marker will be 5.

    Thanks,
    Raoul