Search Unity

World Building EasyRoads3D v3 - the upcoming new road system

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

  1. verteom

    verteom

    Joined:
    Oct 26, 2018
    Posts:
    48
    Hi~I tried to use the free version to teset, but unfortunately it got stuck in my project in 2019.4.12f urp.Just open the demo scene
     
  2. raoul

    raoul

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

    In what way did you get stuck?

    Is this related to pink materials? URP does require URP materials / shaders, otherwise the roads will look pink. For the free version the Lit shader should work fine. For the Pro version we are converting some of the example shaders to URP and HDRP, most of them are already available for those who need it urgently. The HD Roads package, for the Pro version, is more art related. For this package URP and HDRP packages are included.

    Thanks,
    Raoul
     
  3. verteom

    verteom

    Joined:
    Oct 26, 2018
    Posts:
    48
    Thanks reply . It seems work in 2019.3.15f.But when I open GAIA PRO,make a normal terrian, and create easy road gameobject, my project will freeze, and I only close the project and open it again.
     

    Attached Files:

  4. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    The attached image points to the included test scene. Do you mean opening this test scene will freeze unity? I just checked this in 2019.3.11f1 URP, it opens well and the road network is editable.

    Also, there are no known issues regarding Gaia. How do you create an "easy road gameobject"? Is that done through:

    Main menu > GameObject > 3D Object > EasyRoads3D

    Does the same happen in a new scene when then the terrain is added manually though: Main menu > GameObject > 3D Object > Terrain ?

    Thanks,
    Raoul
     
  5. verteom

    verteom

    Joined:
    Oct 26, 2018
    Posts:
    48
    HI~ Actually when I open my terrian scene, and create easy road gameobject, and the unity will be crash.
    upload_2020-10-7_22-16-28.png
    upload_2020-10-7_22-17-3.png
    upload_2020-10-7_22-17-53.png
     
  6. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    In my last post I asked some questions, could you please answer them? That way I know exactly what you do.

    Aditionally, can you open the test scene, delete the road network object and create a new road network object. Does that work?

    If so, can you send the project to us including the scene that crashes so we can test it.

    Thanks,
    Raoul
     
  7. verteom

    verteom

    Joined:
    Oct 26, 2018
    Posts:
    48
    Hi~
    1. It will be fine when I open new scene ,then the terrain is added manually though: Main menu > GameObject > 3D Object > Terrain , also open test scene .
    2.When I create new scene, create Gaia Terrian, then add Hierarchy > 3D Object > EasyRoads3D, It will be frozen for a while,but it seems fine now.

    Is this because I created a Gaia terrain that was too big? So when I create it, easyRoad3D will check the terrian size.
     
  8. raoul

    raoul

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

    At some point during the creation of the Road Network object you will be asked if you want to backup the terrain data. This should be a fairly quick process but the more terrains and the more complex the terrain data like heightmap resolution and vegetation density, the longer this will take. But this should be in the range of seconds. There are no known issues related to Unity appearing to crash, hence why I asked all these questions to see if the problem can be isolated. The same for Gaia, this should work just fine, it is the case since both tools exist. You could try a simple small Gaia terrain just as a test to see if you notice a difference.

    Thanks,
    Raoul
     
    verteom likes this.
  9. verteom

    verteom

    Joined:
    Oct 26, 2018
    Posts:
    48
    Thanks. It seems when I created 4KM -8KM terrian,it will take some time
     
  10. superdiederik

    superdiederik

    Joined:
    Apr 25, 2012
    Posts:
    31
    Hi Raoul,

    Thanks for this great asset. Trying out some of its cool features and it's really pretty nice :)

    Trying to get a good workflow going under URP and Unity terrain (default).
    It all seems to work pretty OK, but you've guessed it: the materials were pink after import.
    So I just used default URP lit materials. And this gives me z-fighting issues.
    Even after going out of edit mode and NOT restoring the terrain.
    I'm not the world's greatest shader coder, so I was wondering if there was already some materials ready or coming that will fix this? I saw you mention something here.
    I couldn't find anything in the Demo Project unfortunately.

    Looking forward to your reply.

    Diederik / Xform
     
  11. raoul

    raoul

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

    The provided EasyRoads3D shaders do indeed include an offset option to deal with z-fighting. The alternative is to use the "Raise" option near the top in the Inspector after switching to Build mode.

    Yes, there are some other shaders in the demo package but they are more intended to show how additional UV coordinates and vertex colors can be used in shaders. A new demo scene is being made with more complete versions of the shaders inclusing full PBR options. Most of them are done and URP and HDRP will be supported. If you want I can already send shaders. Please let me know in that case which URP version you use.

    Regarding the URP lit shader and z-fighting, you could add the Offset to it manually. The line looks like

    Offset x,x

    x is a negative value, the stronger the value the stronger the offset. A value of -1 should already work well.

    Do a Ctrl + F Search for all lines that start with "Tags" and put the Offset x,x line below this line.

    Thanks,
    Raoul
     
  12. superdiederik

    superdiederik

    Joined:
    Apr 25, 2012
    Posts:
    31
    Hi Raoul,

    Thanks for the speedy reply!
    It would be great if you can send me the shaders (I will contact you through the info mail account).
    Mainly because of course I'd want to use the Decal, Blend, Transparancy etc. shaders too, and I'd of course prefer to use the ones you're going to be supporting in the future. I'm using URP 7.3.1

    As for the Raise option you suggest: When I Build the terrain, the road doesn't do any z-fighting at all, and it all looks fine. It's when I do ' Back to Edit-Mode - No terrain Restore that I was hoping to see a non-z-fighting road. No raising of the terrain seems to fix it; it always start jittering again after returning back to edit mode.

    I hope that your new shaders help!

    Diederik / Xform
     
  13. raoul

    raoul

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

    Yes, please send an email so I know where to send the shaders. I will check the shaders for URP 7.3.1

    Yes, in Edit Mode the Raise value is 0. You can use use "Back to Edit-Mode - No terrain Restore" but it is not recommended. In Edit Mode the highlight options in "General Settings > Scene Settings" can be used to clearly visualize the road.

    Thanks,
    Raoul
     
  14. superdiederik

    superdiederik

    Joined:
    Apr 25, 2012
    Posts:
    31
    Thanks Raoul!
     
  15. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    178
    Hi @raoul ,

    Thanks for this great asset. I'm starting using it with Unity 2020 and URP 8.2. Can i have the URP shaders version please ? Thanks
     
  16. raoul

    raoul

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

    Glad to hear you like the tool. I will check 8.2. can you send an email so I know where to send them to?

    Thanks,
    Raoul
     
  17. Andefob

    Andefob

    Joined:
    Sep 17, 2018
    Posts:
    99
    Hello again!

    After working with other things for a while, I will soon think about side objects and connections with scripting again. It is still a bit confusing how the system exactly works. My idea is to have a number of base scenes on top of with players can draw their own roads (using scripting API). The basics are already working but I would I need to add support for side objects and possibly some basic connections (possibly I, Y and X). So should I make one common ERRoadNetwork prefab I can use in all the base worlds? Does the ERRoadNetwork instance itself contain all required information or does it have references to other project specific shared prefabs like ERProjectLog or ERSideObjectsLog or what are they for? So what stuff is project specific and what is scene specific?

    About scripting API, I guess it is not yet possible to set "Start Level Distance" and "End Level Distance" for "No terrain deformation setting" in scripting API or am I just missing it? Also when investigating connector properties (at least related to I connector), I couldn't find how you can by scripting change stretch width, connector distance and subdivision settings. If they are not there but can be added, I would appreciate it a lot. About road types - I would like not to use lots of different road types but just have all roads to be of the same generic type and then by scripting possibly change material and width etc. I hope this is possible with connectors even though the manual is implying one should use road types with connectors...

    And just one more question... Were there already somewhere examples of how to make an intersection/connection where one small road departs from a bigger road (for a pitlane in a racing track)? Closest thing to that is now the Y connector in add-on package but it is not quite what I would like. Or is this something that is not coming until 3.3?

    Thanks again,
    Ande
     
  18. raoul

    raoul

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

    Built-in v3.1 intersections / connections are project specific, these prefabs will be available in all scenes.

    Road types can be generated at runtime, but it is much easier to already setup the scene with road types. The same for side objects, which is work in progress, but side objects must already be available for the road network in the scene.

    The scripting API is additional, the main features were added when the tool was released. At the moment options are added upon request.

    "Start Level Distance" and "End Level Distance" options can be added. The additional I Connector options are perhaps more complicated in a way that this usually is a matter of trial and error. I don't know what system you are making but trial and error situations at runtime is perhaps something you want to avoid. What would perhaps be useful is the stretch option in a way that it can be auto set to the width difference of the involved roads, not by the user.

    Have you tried this sort of situations manually in the Inspector with the current built-in crossing options? Do you like the results? In that case it would be a matter of preparing matching crossing prefabs. Or changing a connection road type could be added to the scripting API. The Flex Connector in v3.3 will be able to do this automatically with probably better results. I belief this already works through the scripting API in the current v3.3 alpha.

    Another way of doing this, also in v3.1 is to include matching intersections based on imported models, that way these connections can be made exactly the way you want them to be.

    v3.3 will include customizable highway exit ramps which is also something that can be used for race tracks and pitlanes. The upcoming new v3.2 demo scene will include examples of this, something like the below which is work in progress.

    pitlane.jpg

    Thanks,
    Raoul
     
    JamesWjRose likes this.
  19. Andefob

    Andefob

    Joined:
    Sep 17, 2018
    Posts:
    99
    Ok! So they are saved under some prefabs in Resources folder?

    Great!

    Yes I don't know how exactly it should be used and probably just as you explained (modifying length and curve of transition). I don't know the implementation details on your side but if the same values could easily be tuned by scripting API that can be tuned in editor, I could figure out the rest.

    Ideally, I would like to just ignore road types and consider every road an individual road with adjustable width and material. So should that in theory be possible?

    My tests with 3.1 connectors didn't go well yesterday since even when I followed the steps in manual (with ER3.1 and add-on) in editor, when I added any connector to the scene, I couldn't connect any roads to it as none of the connector knobs where available - that's partially why I got frustrated and started to ask these questions to understand better how the system works and what could have gone wrong - is it about road types or what. I did manage to make connections last time I tested so maybe I'll just need a new clean install...

    That looks great! I am looking forward to that!

    Thank you very much,
    Ande
     
  20. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Yes, the prefabs are located in /Assets/EasyRoads3D/Resources/dynamic prefabs/ and /Assets/EasyRoads3D/Resources/custom prefabs/


    When the same roads will be reused and when intersections are involved it is recommended to work with road types, certainly in v3.3 Flex Connectors and built-in highway ramps.

    How was the I Connector add to the scene? Typically they are inserted at road markers, so either roads objects already connected to both sides of the I Connector, or the road connects to one end and a green hanble will be free on the other end. Another road can connect to this handle. I Connectors do not require roads based on a road type.

    Thanks,
    Raoul
     
  21. Andefob

    Andefob

    Joined:
    Sep 17, 2018
    Posts:
    99
    I-connectors did work, yes, but when I tried to add other types of connectors, none of them worked (I tried 2-3 different ones). I could add them to the scene but they did not have those connection handles, only the one handle in the middle. Also markers had no options for other connection types.

    As mentioned, how I would like to set up things is that for a user, there are no road types visible but the width and material of a road can be freely adjusted (this is working already). Then, there would be some set of available connectors and it would be up to the user to make the connections look good. If they don't, it is still better than not having the connection at all. Ideally, there would at least be options to tune the distance in which the width is stretched if widths don't match. Most of the time, road materials would probably be the same anyway. So is this somehow possible at the moment with 3.1 or 3.2? Or should I anyway setup one road type that all roads are using (even if material and width are changed)?

    Sorry if the questions are stupid but I still don't fully get how the system works and what can and cannot be done in my situation.

    Thanks,
    Ande
     
  22. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Which connectors are involved? Which packages do you have imported? Were no connection handles visible at all or did they turn red when moving a road towards these connections?

    The system is primarily intended for road network creation in the Unity editor. Taking into account that along the process of building the road network you may want to make changes to specifc roads, using road types will make the road network so much better manageable. For example, you want to change the road with or the material of a specific type, you only have to make the change to that road type and press "Update Scene Instances", all matching roads will be updated. Is this relevant for your runtime project?

    For v3.1 built-in intersection and for custom intersections based on models the road type is not required. But it is useful. By assigning road types to intersection connections, new roads extruded from these connections will be based on that road type. This is relevant in the Unity editor. Is this behaviour relevant for your runtime project?

    What is important is the shape of the connection. in v3.1 the default shape of a built-in road type is two nodes, one on the left one on the right. The same for 3.1 built-in intersections, so built-in road shapes and built-in intersections work well together. Intersections based on models can be more complex, attached roads will inherit that same road shape, but these roads cannot be attached on the other end to connections with a different shape, the connection handle will turn red. If you have mixed type of intersection prefabs in your runtime project you will have to keep track of this when creating the the road network through the scripting API.

    v3.3 will support built-in custom road shapes with more then two nodes, this works for the v3.3 Flex Connectors, but this is based on road types. So if you want to develop your runtime solution with this in mind, then using road types is important.

    When the intersection connection with is 8 and a road is connected with a width of 6 then the road will gradually stretch to 8 at the connection point. This can be tested manually tested quickly in the Unity editor.

    Is this the information you are looking for regarding road types? Is there anything else that is unclear?

    Thanks,
    Raoul
     
  23. maurosso

    maurosso

    Joined:
    Feb 19, 2017
    Posts:
    50
    Hi Raoul,

    We are having some issues with road textures in a build project.

    Unity version: 2019.4.12f, Easy roads Pro: 3.1.9.f2

    In editor play mode, everything seems fine, but in a standalone build, the road textures in some places are broken.
    This happens in some of the places, not all along the route.

    Initially, i thought it might be because the road is too long, but I've cut it up, using I-Connectors. This has not helped too much, but did change where the textures appear broken.

    Any idea what might be the cause?

    The first screen is from the editor play mode. This is how the road looks when in editor, and play testing.
    The two following screens are from a build.
     

    Attached Files:

  24. raoul

    raoul

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

    How long are your roads? This looks like UV floating point in accuracies starting further away from the start. Roads are usually cut in smaller sections through intersections. If that is not the case, there are two fixes when this happens:

    1. Insert I connectors at intervals at a distance just before the texture inaccuracies start to happen. Inserting I Connectors will split the road in separate objects which is also better for performance for longer roads. The I Connector options is available further below in the marker section

    2. The reason why this happens in the final build and not in the Unity editor is most likely related to the project settings, specifically: Project Settings > Player > Other Settings > Optimization > Vertex Compression > Tex Coord 0

    Thanks,
    Raoul
     
  25. Andefob

    Andefob

    Joined:
    Sep 17, 2018
    Posts:
    99
    I don't think there were any red connectors visible, just on middle one. But I am again focusing on other things for a while. If the problem persists next time I try to do this I will give you more and better information. Probably it was some kind of user error :).

    This is probably something I don't want in my project as each level/track should be its own entity and it can specify its own road settings so that it doesn't change the settings of roads in other tracks. Since the initial idea is to support racing tracks, I get quite far with just one closed road per scene and this is already working. The more complex stuff with connectors becomes relevant with pitlanes and possibly with more complex levels. I can later post a link to my next level editor demo once I get some new features finished first.

    I am not sure yet how exactly the UI with connectors would work at runtime so I am not sure. Probably it would be enough to just have some crude way of telling one connector of another road is linked to a connector (the API already has that so maybe it works already if rights connections have been set up).

    This is probably enough for now. I may come up with more questions or share what I have been doing later :). I will probably want to wait for the next 3.2 version before going further with these though.

    Thank you again!
    Ande
     
  26. raoul

    raoul

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

    In my previous post I merely described specific requirements and why using road types is very much recommended, it is all Unity editor workflow related. I would think your runtime solution will be something similar but it is up to you what the workflow will be. The only thing that will probably be important is test your intersections in the Unity Editor with roads that are not based on road types (if that is what you prefer). Building the roads through the scripting API will have the same behaviour.

    v3.2 is very much ready for release, if there are issues with the beta package in the asset store import, please let me know.

    Thanks,
    Raoul
     
  27. Andefob

    Andefob

    Joined:
    Sep 17, 2018
    Posts:
    99
    The issue because of which I haven't wanted to to upgrade so far is the one I mentioned here (and which I mentioned later also) (with 3.2.0 beta 6). That makes all my tracks look much worse than with 3.1. Based on the previous discussions I had hopes this might be fixed in beta 7...

    To clarify, the bug is visible after generating roads via scripting for a road whose smoothing has been set with road.SetSplatMap. If terrain is restored, all is fine again so this is different from the other splatmap issue I also mentioned. About this issue - with 3.1 this worked well but in 3.2b6 there is a clear zig-zagging seam between the end of smoothing area and the original terrain splat map. With 3.1, the alpha of the side texture seemed to gradually go from side texture opacity to 0. Now however it looks like the alpha is 1 for the whole smoothing area from the beginning to the end, causing a little seam at the starting point and a worse seam at the end.
     
  28. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    We have tested baking the road shape in the terrain splatmaps, we couldn't notice any issues. I will prepare and send you a build so you can test on your end.

    Thanks,
    Raoul
     
  29. AlexFurdui

    AlexFurdui

    Joined:
    Feb 1, 2020
    Posts:
    6
    I make a terrain 100% flat
    And I put road on terrain
    And my terrain when I go to finalize road terrain don't adjust good man and terrain is flat whyyyyyy go over the road.
    And i tried to make whit options follow contours and same!!!!!
    in minutes 9:00 of this clip, this man have problems like me, please help Thanks
    Ps: I don't speak good English.
     
  30. raoul

    raoul

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

    At 9:00 Terrain Deformation was off, this is visible at 10.40. After switching Terrain Deformation on the terrain is updated correctly later in the video.

    "Follow Terrain Contours" works like in the real world, usually the road shape is first adjusted to the contours of the terrain based on the Threshold value. After that the terrain is adjusted to the final road. Imagine a very bumpy terrain, it would be impossible for the road to exactly follow the terrain as it is and get a realstic results. But this option is available through the scripting AI in the ERRoad class: SnapToTerrain(bool value), which will work well on smoothly rolling terrains.

    Is your problem indeed related to this? The Troubleshooting page in the manual covers all terrain situations and how to deal with possible issues.

    Thanks,
    Raoul
     
  31. AlexFurdui

    AlexFurdui

    Joined:
    Feb 1, 2020
    Posts:
    6
    [QUOTE = "raoul, post: 6423694, membru: 1799"] Bună AlexFurdui,

    La 9:00 Terenul Deformare a fost dezactivat, acest lucru este vizibil la 10.40. După comutarea Terrain Deformation pe teren este actualizat corect mai târziu în videoclip.

    „Urmăriți contururile terenului” funcționează ca în lumea reală, de obicei forma drumului este mai întâi ajustată la contururile terenului pe baza valorii pragului. După aceea, terenul este ajustat la drumul final. Imaginați-vă un teren foarte accidentat, ar fi imposibil ca drumul să urmeze exact terenul așa cum este și să obțină rezultate realiste. Dar această opțiune este disponibilă prin AI de scripting din clasa ERRoad: SnapToTerrain (valoare bool), care va funcționa bine pe terenuri care rulează fără probleme.

    Problema ta este într-adevăr legată de asta? Pagina de depanare din manual acoperă toate situațiile terenului și modul de soluționare a posibilelor probleme.

    Mulțumiri,
    Raoul [/ CITARE]
     
  32. AlexFurdui

    AlexFurdui

    Joined:
    Feb 1, 2020
    Posts:
    6
    Man when he(man from video) enabled follow terrain contours he increase height of road because terain was higher than road, if I increase height of road I go fall bad whit car and I stuck my car omg,
    Wtf, is not easyroad3d is hardroad3d because I stay 3 hours to make a flat road(I make in 5 minutes but problem whit terrain I can't solve in 3hours) maybe I put a 3d cube and I apply material and it is easier than work whit "HardRoad3D", make a tutorial on YouTube man how to work whit terrain to put road on them.
    Sorry for my bad English.
     
  33. raoul

    raoul

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

    The video you posted does not show a problem with EasyRoads3D itself. If terrain Deformation is switched off, the terrain will not be adjusted. The road will float above the terrain or the terrain will break through the road.

    Can you show clearly what you situation is and how this might relate to possible terrain situations described in the Troubleshooting section of the manual, https://www.easyroads3d.com/v3/html/troubleshooting.html#terrain

    You mention issues with the terrain, EasyRoads3D works with the terrain object which does have its limitations. The question is, what in your scene is related to this? Our email is located in the readme in the EasyRoads3D root directory. If you want you can email us your scene so we can look at it.

    Thanks,
    Raoul
     
    Last edited: Oct 16, 2020
  34. econt

    econt

    Joined:
    Apr 8, 2019
    Posts:
    52

    Hello Raoul,

    thank you very much for the explanation. - I have a problem with Connecting roads to junctions which are instantiated.
    It looks like the function ConnectToStart() applies the differnt (world) position to the road starting position (marker position) as it should. So the road is not connected to the connection.
    (Using v3.1.9f5)

    Steps to reproduce:


    Instantiate Connection default x crossing:
    ERConnection _erConnectionBegin = roadNetwork.GetConnectionPrefabByName("Default X Crossing");
    roadNetwork.InstantiateConnection(_erConnectionBegin, "Crossing1", Vector3.zero, Vector3.zero);

    Make Road from list of Markers:
    Vector3[] markers = new Vector3[2];
    markers[0] = new Vector3(1, 0, 0);
    markers[1] = new Vector3(20, 0, 0);

    int _connectionIndex = 0;
    road = roadNetwork.CreateRoad("road 1", roadType, markers);
    print("Before road.ConnectToStart()");
    print("Marker0" + markers[0]);
    print("Marker0" + markers[1]);
    print("road 0" + road.GetMarkerPosition(0).ToString());
    print("road 1" + road.GetMarkerPosition(1).ToString());

    Get the nearest connection and connect the Road to the Connection:
    _connectionIndex = _erConnectionBegin.FindNearestConnectionIndex(markers[0]);
    print("nearestMarkerposition" + _connectionIndex);
    road.ConnectToStart(_erConnectionBegin, _connectionIndex);

    // Build Road Network
    roadNetwork.BuildRoadNetwork();

    print("After road.ConnectToStart()");
    print("Marker0" + markers[0]);
    print("Marker0" + markers[1]);
    print("road 0" + road.GetMarkerPosition(0).ToString());
    print("road 1" + road.GetMarkerPosition(1).ToString());



    Please observe that the Marker0 gets a vector3 value of (315.6, 0.0, 50.4) which is the "worldposition" of the connection point function instead of the "local postion" 5.5,0,0 if the connection-index 2 would be the nearest point. - So the road is not connected with the connection.

    What could be the solution?


    Thanks in advance
     
  35. raoul

    raoul

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

    I am not sure if I understand the problem correctly? The world position of the connection center is the new position of the specific marker so if that is (315.6, 0.0, 50.4), then that is correct.

    Is the connection returned by FindNearestConnectionIndex() correct and is that world position indeed (315.6, 0.0, 50.4)?

    Thanks,
    Raoul
     
  36. econt

    econt

    Joined:
    Apr 8, 2019
    Posts:
    52
    Hi Raoul,

    the problem is that the road is not connecting to the connection. And the reason could be that the position which is generated by road.ConnectToStart() might be the wrong one.

    My aim is to instantiate a Default x crossing at 0,0,0 WorldPostion (it works) and than make a road which goes from the connection point out 20 Meters to the right like this (road and connection are not connected now in this picture):

    upload_2020-10-16_12-38-54.png

    But if I connect the road with the connection with the line of code: road.ConnectToStart(_erConnectionBegin, _connectionIndex);
    It looks like this:

    upload_2020-10-16_12-43-42.png

    What would be the correct code example to reach the aim?

    Thanks in Advance
     
  37. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Sorry, looking at your code again I think the problem is that _erConnectionBegin is used instead of an instance of this prefab:

    Code (csharp):
    1. ERConnection _erConnectionBegin = roadNetwork.GetConnectionPrefabByName("Default X Crossing");
    2. roadNetwork.InstantiateConnection(_erConnectionBegin, "Crossing1", Vector3.zero, Vector3.zero);
    _erConnectionBegin is the prefab in the project folder. Which is then instantiated. The second line should look something like this:

    Code (csharp):
    1. ERConnection _instance = roadNetwork.InstantiateConnection(_erConnectionBegin, "Crossing1", Vector3.zero, Vector3.zero);
    Then Line:

    Code (csharp):
    1. _connectionIndex = _erConnectionBegin.FindNearestConnectionIndex(markers[0]);
    should be:

    Code (csharp):
    1. _connectionIndex = _instance.FindNearestConnectionIndex(markers[0]);
    and line:

    Code (csharp):
    1. road.ConnectToStart(_erConnectionBegin, _connectionIndex);
    should be:

    Code (csharp):
    1. road.ConnectToStart(_instance , _connectionIndex);
    Does that work better?

    Thanks,
    Raoul
     
  38. econt

    econt

    Joined:
    Apr 8, 2019
    Posts:
    52
    Yes, it works.

    Thank you very much!
     
  39. Guacamolay

    Guacamolay

    Joined:
    Jun 24, 2013
    Posts:
    63
    Hey, I really like this asset, however sometimes I get some weird errors when using the inspector tools

    In this case, when I add concrete guard rails to the side of the road, and try to expand the options in the inspector, I get this error. The guard rail is there on the road, but I can't open the options. I'm using v3.1.9f5

    Any ideas what might be causing this?

    Also a quick question on sidewalks. I understand v3.3 will have the option to have sidewalks on roads rather than using crossings which is great. So for now is my best bet to use side objects to create my sidewalks?

    upload_2020-10-17_14-57-50.png

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. EasyRoads3Dv3Editor.ODODQCQCOC.DisplayRoadSoControls (EasyRoads3Dv3.ERModularBase scr, EasyRoads3Dv3Editor.ODODQCQCOC eScr, EasyRoads3Dv3.ERSORoadExt soData, EasyRoads3Dv3.ERModularRoad roadScr, System.Int32 index, System.Boolean& hasChanged, System.Boolean isScene, EasyRoads3Dv3.QDQDOOQQDQODD rt) (at <9142e9987c6b4868bc1aadd083f8c82f>:0)
    3. EasyRoads3Dv3Editor.ODODQCQCOC.OOQQOODOQQ (UnityEngine.Event cEvent) (at <9142e9987c6b4868bc1aadd083f8c82f>:0)
    4. EasyRoads3Dv3Editor.ODODQCQCOC.OnInspectorGUI () (at <9142e9987c6b4868bc1aadd083f8c82f>:0)
    5. UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <e6e2fa0a47414cd2ac33237924761b45>:0)
    6. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
     
  40. raoul

    raoul

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

    You mention guard rails, are the the guard rail side objects from the additional demp package or did you create your own guard rail side object? Does this happen on any road object or only this specific road object?

    Yes, in v3.3 sidewalks will have its own section in General Settings, default sidewalks can be assigned and activated on road types and indivisudal road objects. Not all current sidewalk options are implemented yet but in general this is functional. I will prepare a new alpha build within the coming weeks.

    Meanwhile, if sidewalks are only required on roads and not on crossings then generating them as side objects is indeed also an option.

    Thanks,
    Raoul
     
  41. Guacamolay

    Guacamolay

    Joined:
    Jun 24, 2013
    Posts:
    63
    Hey again - it seems to have fixed itself! Not sure if it was restarting Unity or playing around with the roads shape that did it - but it's seems to be working correctly now :)

    Thanks for the tip on sidewalks - I'm getting to grips with all the features, and the side objects tools are really cool, so I'm happy to go with that!
     
  42. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    Hi. is there any actions for playmaker? I want use this asset again with Playmaker to build roads in runtime.


    I learned how to build a new road with 2 markers with the help of runtimeScript in C#. But how can I add marker to this road in runtime? Let say I have two roads now I need to add a new marker to the first road how can I do that from a new script?
     
    Last edited: Oct 18, 2020
  43. econt

    econt

    Joined:
    Apr 8, 2019
    Posts:
    52
    Hi Raoul,

    is it possible to create junctions with the API? - Are there information how to it?

    Thanks in Advance!
     
  44. raoul

    raoul

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

    Please let me know if this happens again, it would be good to know what caused it. And good to hear you are finding your way around the side object system.:)

    Thanks,
    Raoul
     
  45. raoul

    raoul

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

    That is possible through the ERRoad class:

    public void AddMarker(Vector3 position)
    public void AddMarkers(Vector3[] positions)
    public void InsertMarkerAt(Vector3 position, int index)

    Thanks,
    Raoul
     
  46. raoul

    raoul

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

    Do you mean new prefab junctions? That is currently not possible. What exactly are you looking for.

    The v3.3 Flex Connector is supported through the API, this connector is based on road types not on a junction prefab.

    Thanks,
    Raoul
     
  47. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    178
    Hi Raoul,

    I was playing with the shader "ER Dirt Road fade In" (URP version that you've sent in PM ) to use Fade In Distance and blend my road to my terrain, but i'm getting weired results :

    PS; i'm using Unity 2020.1.9 and URP 8.2

    Here is how my material config look like :




    and here is what my road look after applying this road material :



    Any idea of what can cause this ?

    Thanks
     
  48. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    I mean, how do I determine which road should get new marker? There is two roads I want to add a marker to first road.
     
  49. raoul

    raoul

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

    The shaders I sent require a map for Metallic AO and Smoothness. I belief I included a simple default small texture for this. Can you assign that texture?

    Thanks,
    Raoul
     
    amynox likes this.
  50. raoul

    raoul

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

    I don't know what your code is. To get a reference to the ERRoad instance this can be used, ERRoadNetwork class:

    public ERRoad GetRoadByGameObject(GameObject object)
    public ERRoad GetRoadByName(string name)

    Thanks,
    Raoul