Search Unity

World Building EasyRoads3D v3 - the upcoming new road system

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

  1. tomobiki

    tomobiki

    Joined:
    Sep 27, 2020
    Posts:
    65
    Ok thanks; I'll follow your advice!
    Bye and keep up the good work!!
     
  2. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Ok, the settings can also be compared with other Shape type of side objects, like the retaining wall example, or with other side objects you may have created. Otherwise let me know if you have further questions regarding this.

    Thanks,
    Raoul
     
  3. tomobiki

    tomobiki

    Joined:
    Sep 27, 2020
    Posts:
    65
    Thanks, I'm following your advices, but I noticed that each time I assign a material to the side object I get an error, that you can see in the picture enclosed.
    I get the same error for any material I assign, even the ones of the demo package that work well with the other side obijects, so probably the problem is in the shappe object that I defined.

    I also copied the settings from the retaining wall, according to your advice.

    Thanks.

    upload_2022-5-26_19-5-21.png
     
  4. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    As mentioned on the previous page, it is hard to comment on this without seeing it. The only thing I see in the new image is that it appears that this object is not inside terrain tiles. Side objects can interact with the terrain depending on the settings. Could that be involved?

    Otherwise, would it be possible to send the project / scene to me by email or send a download link in a direct conversation here through the forum options? That will be the quickest way to resolve this.

    Thanks,
    Raoul
     
    Last edited: May 26, 2022
  5. tomobiki

    tomobiki

    Joined:
    Sep 27, 2020
    Posts:
    65
    Hi Raoul,
    thanks; I'll do some tries following your suggestions; if I'll be not able to fix the problem I'll email to you the project.
    Thanks again and sorry for bothering.
     
    raoul likes this.
  6. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    v3.2.1f4 is now available

    This update includes fixes for recently reported issues and various requests, also here on the forum.

    The demo package which uses a light version of the v3.3 beta will be updated next week.

    As always, please backup your project first before importing the update.

    Thanks,
    Raoul
     
    marcell123455 likes this.
  7. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hey @raoul

    i decided to update to latest 2022.1.2f1 Unity version and i am having this error, but i have my terrain added to layer 15 and the Road Network set to 15 as well !

    What could it be, the Unity version may be !?

    EDIT : it seems related to the terrain itself. It's nothing unusual with it but it is created using Gaia. If i copy terrain component and paste it to another terrain, then it works ! Still any suggestion or an idea ?

    EDIT2 : nvm raoul, it probably got bugged out. It seems to work with another generated terrain. If the issues shows up again i will let you know !

    upload_2022-5-30_10-6-19.png

    upload_2022-5-30_10-6-54.png

    upload_2022-5-30_10-5-35.png
     
    Last edited: May 30, 2022
  8. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hey again @raoul
    in regard to above post, i still seems to have that error and another one in addition !

    I just bound the HD pack and i'm currently trying all the roads. Some of them seem to be invisible, no material or something, also when i try to switch the type of existing road in the scene, it throws this error as in the image...

    Just wanted to report that. I'll try to deal with these issues myself and will get back if i have more info !

    Cheers !

    upload_2022-5-30_11-58-55.png
     
  9. raoul

    raoul

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

    Do you mean that you upgraded from an older Unity version (2021 or older) to Unity 2022.1.2f1?

    In that case, did you also reimport the EasyRoads3D package from the Asset Store? because Unity 2022 requires an EasyRoads3D package update as well.

    And regarding the second part, the error in your post can indeed be related to this. In order to avoid Layer issues, please use a unique layer for EasyRoads3D internal processes, the default layer that is used is Layer 31.

    Regarding the material issue, when was this road network created? Physics Material issues like in your post could happen in early v3.2 versions. Or is it related to Unity 2022 and an older EasyRoads3D version being imported, because this can result in several issues.

    Thanks,
    Raoul
     
  10. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    No, i previously used 2022.1.1f1, Just updated yesterday to 2022.1.2f !

    Also i just updated to the latest Easy Roads 3D Pro from the store, like a couple of hours ago and imported the HD Assets package after that !

    I am, as shown in the images above ( posting below again ), i'm having a terrain layer ( 15 ) for a long time, and also did choose the same number in ER settings

    upload_2022-5-30_12-22-16.png

    upload_2022-5-30_12-19-56.png

    I just created the road network in a new scene !
     
  11. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    This issue with heightmap seems to happen when i have more than 1 road object in the scene
     
  12. raoul

    raoul

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

    Is there a specific reason why you choose the ER layer to be on the same layer 15?

    Have you tried changing the terrain layer to another layer or put the EasyRoads3D layer back to 31?

    I am not saying that this is the issue, but the warning your posted has an history of other game objects (the terrain in this case) being on the same layer as the layer that EasyRoads3D uses internally. So when you mention that similar layers are used, than that would be the first thing to check.

    Thanks,
    Raoul
     
    Vagabond_ likes this.
  13. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi @raoul

    i'm sorry i wasted your time with this one :D, i got confused for some reason even though i actually have a dedicated layer for ER... all actually works when i set the layer correctly !

    If i can ask one more question, i went through all road types from the HD package and made the roads width from 8 to 14. How i should go about adjusting all crossings to match the new road width !?
     
  14. raoul

    raoul

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

    So this was indeed layer related, that is good to know.

    The road types and connection prefabs in the HD Roads package have a custom set up for more control over the materials by using vertex colors. This means the connection prefabs are based on imported models which indeed means that they will not auto update to road type width changes like built-in connections do.

    To solve this, please update the scale of those prefabs you like to use in the folder /Assets/EasyRoads3D/Resources/custom prefabs/

    The road width change from 8 to 14 means that the transform scale in the Inspector should be multiplied with 1.75. I would try this on one prefab. Instantiate this prefab in the scene and connect a road. The widths should match. If that is indeed the case, all other prefabs can be updated accordingly.

    Thanks,
    Raoul
     
    Vagabond_ likes this.
  15. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Awesome, some of the crossings have already some scale different from 1.0, but when i scale with addition 75% it seems to work !

    Cheers !
     
    raoul likes this.
  16. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Yes, that is why mentioned multiplying the current scale value by 1.75.

    Glad to hear that indeed works well!

    Thanks,
    Raoul
     
  17. Tanoshimi2000

    Tanoshimi2000

    Joined:
    Feb 10, 2014
    Posts:
    46
    Is there a tutorial for creating endless runner (tiling roads) with EasyRoads3d? I've searched the forum and Youtube, Ideally, I'd like to take advantage of everything (terrain deformation, side object placement, texturing) but even if it has to be flat, I'd like to be able to shift control points so that I can get curvy roads. Any tutorials?
     
  18. raoul

    raoul

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

    Is this related to runtime road creation? The main EasyRoads3D Pro package includes a runtime scene example in which a road is created.

    For an endless road you probably want to add road marker control points at the end and remove road markers at the start. In this situation you do not want to have the UV coordinates reset. To avoid that, from the docs, in the ERRoad class:

    public bool ClampUVs(bool value)

    Generate UVs clamped to 0 at start and 1 at end. This is by default the case. Setting this to false is for example useful for never ending roads created at runtime where markers behind the cam are removed. The UVs at the new start will be generated relative to the same decimal value as for the previous road update.



    Also, since you mention that side objects will be involved, the mentioned script example creates a new road network at runtime. You want to already create the road network in the Unity editor. That way both road types and side objects can be set so they can be loaded at runtime. The side objects can also be activated for the used road type inside the Unity editor. That way they will be generated automatically at runtime.

    Will this get you started?

    Thanks,
    Raoul
     
  19. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    93
    I am looking into this to potentially use it for my racing games. I had a few questions after watching a youtube video about it.

    I am not sure exactly what 'terrain' is in Unity. In my game, I am constructing my own low poly terrain using Probuilder or Blender. Can this qualify as 'terrain' or will it not work with EasyRoads?

    Also, can you build roads without the support of terrain at all, like in Fzero GX where the road (race track) is free floating in space?
     
  20. bircastri

    bircastri

    Joined:
    Jun 19, 2019
    Posts:
    15
    I have this Scene with Terrain and some roads. So I need to bend the selected road or another treatment of road. But I m not able to make this task. This is what can I do
    Cattura.JPG

    Could you help me please?
     
  21. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hello @brittany,

    One of the features of EasyRoads3D is that it can update the terrain shape to the road network. This feature will only work with the Unity terrain object. If this feature is required, than an option is to use a Unity terrain object, adapt it to the road network shape, export it so it can be optimized to low poly in for example Blender.

    But EasyRoads3D can be used on a mesh terrain. General settings > Scene Settings > Mesh terrain.

    After dropping your mesh terrain in this slot, Shift + Click will create the road marker control points relative to the mesh terrain heights.

    And EasyRoads3D does indeed also work with no terrain object at all, free floating in space. The road marker control points will be added relative to the cam orientation.

    Thanks,
    Raoul
     
  22. raoul

    raoul

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

    The screenshot is zoomed out. The hierarchy shows that the selected road is not an ordinary EasyRoads3D generated road network. But I do see an EasyRoads3D road network object at the bottom that appears to be disabled.

    In EasyRoads3D roads are generated by adding road marker control points through Shift + Click, the roads will bend based on the marker control point positions.

    Can you post the exact steps you take to create the roads?

    Thanks,
    Raoul
     
  23. bircastri

    bircastri

    Joined:
    Jun 19, 2019
    Posts:
    15
    Hello Raoul, thaks for your answer. I need to change this Scene of the game that I have not developed unfortunately. So I try to show you all objects of my Scene.

    I have an Object LT Terrain thant contains 6 terrains, every terrain contains a road.

    upload_2022-6-1_9-44-18.png

    I hope that this print screen can be help you to know how i composed my system.
    If I try to select on a road object of terrain, this is what can I see:

    upload_2022-6-1_9-45-48.png

    Every terrain with our road is positioned in a precision position near another terrain.
     
  24. raoul

    raoul

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

    As mentioned in my previous reply, your hierarchy shows road objects that are not part of the main road network object which by itself is disabled. This is not a standard setup.

    I am not sure what you want to do? Can you provide exact steps how you want to change the road objects in the current scene?

    If this involves creating / changing the road objects, than the main road network object which is still disabled in the new screenshots, should be active. And the road objects should be part of this road network object.

    Thanks,
    Raoul
     
  25. bircastri

    bircastri

    Joined:
    Jun 19, 2019
    Posts:
    15
    OK, I need to insert a right turn and left turn into this Scene.
     
  26. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Your hierarchy shows something is not quite right regarding the road network, it is not a standard road network setup. The road network object is disabled, it is not possible to make changes.

    And the selected road objects in the scene in the screenshots either do not appear to be generated by EasyRoads3D or are finalized road objects because the Inspector do not show the EasyRoads3D script components.

    Is this actually part of the problem? Or can you create new road objects, select road markers, move road markers?

    Regarding your general question about right and left turns, see below the introduction video at 15:16, road markers are added to the selected road object using Shift + Click, the road shape adjusts to the marker positions.



    Thanks,
    Raoul
     
  27. bircastri

    bircastri

    Joined:
    Jun 19, 2019
    Posts:
    15
    From you is it necessary, to create everything from scratch? In the sense of deleting road objects and creating a road network?
     
  28. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    I have to do some guessing and there is no full feedback on what I am asking. So I am not sure if my answers are relevant?

    I guess these are road objects generated by EasyRoads3D and the road network was Finalized at the end?

    In that case, "Finalize" is optional, it means that all script components are removed leaving only the generated road meshes. It is mentioned in the confirmation box when this button is pressed. It is recommended to backup the scene or the project before using this option.

    Thanks,
    Raoul
     
  29. joanpescador

    joanpescador

    Joined:
    Dec 21, 2016
    Posts:
    122
    Hi Raoul.
    I just saw the v3.2.1f4 update.
    Let me thank you very much.
    Being able to update Vegetation Studio's side objects via the API is a big step for me.
    Anyway, I'm using beta v3.3b7 so I can sync the side objects at crossing sections.
    My question is, should I choose between one and the other functionality? Is there a way to have both functionalities?
    How I should proceed? Do I install v3.2.1f4 over v3.3.b7 already installed?
    Thanks, Joan
     
  30. marcell123455

    marcell123455

    Joined:
    Jun 18, 2014
    Posts:
    275
    Hey @raoul,

    I am trying to make use of the new sideobject script api functions. But it is somehow not working. My debug messages won´t show up.
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEditor;
    5. using EasyRoads3Dv3;
    6.  
    7. [CustomEditor(typeof(AutoRoadExtensionSetup))]
    8. public class AutoRoadExtensionSetupEditor : Editor {
    9.  
    10. public AutoRoadExtensionSetup scr;
    11.     ERRoadNetwork roadNetwork;
    12.     SideObject RoadCurbExtension;
    13.     void OnEnable()
    14.     {
    15.         scr = (AutoRoadExtensionSetup)target;
    16.         ERRoadNetwork.onRoadUpdate += OnRoadUpdate;
    17.     }
    18.  
    19.     void OnDisable()
    20.     {
    21.         ERRoadNetwork.onRoadUpdate -= OnRoadUpdate;
    22.     }
    23.  
    24.     public void OnRoadUpdate(ERRoad road)
    25.     {
    26.         Debug.Log("road Update: " + road.GetName());
    27.        
    28.         ERRoadNetwork roadNetwork = new ERRoadNetwork();
    29.         SideObject RoadCurbExtension = roadNetwork.GetSideObjectByName("CurbExtensionArea");
    30.         //Debug.Log(RoadCurbExtension.name); Works
    31.        
    32.         if (road.GetSideObjectActiveState(RoadCurbExtension))
    33.         {
    34.             // Debug.Log(road.GetMarkerCount()); Works
    35.             for (int i = 0; i < road.GetMarkerCount(); i++)
    36.             {
    37.                 //works unitl here.
    38.                 if (road.GetSideObjectMarkerActiveState(RoadCurbExtension, i))
    39.                 {
    40.                     Debug.Log(RoadCurbExtension.name + " Is Active On Marker " + i);
    41.                 }
    42.  
    43.                 if(road.GetSideObjectMarkerActiveStateSides(RoadCurbExtension,i) == ERRoadSide.Left)
    44.                 {
    45.                     Debug.Log(RoadCurbExtension.name + " Is Active On Marker " + i+ " left");
    46.                 }
    47.  
    48.                 if (road.GetSideObjectMarkerActiveStateSides(RoadCurbExtension, i) == ERRoadSide.Right)
    49.                 {
    50.                     Debug.Log(RoadCurbExtension.name + " Is Active On Marker " + i + " right");
    51.                 }
    52.  
    53.             }
    54.         }
    55.     }
    56. }
    57.  

    My curb sideobject is enabled on the road.My Sideobject has dual sided enabled in the settings. Default active marker state is disabled. I enabled it on some markers left and right or both for testing. My exspected result would be some debug messages, but I can´t get it working. Any ideas?

    Thanks
     
  31. raoul

    raoul

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

    The v3.2.1f4 update does indeed include the VS update after calling CenterPivotPoints() via the API.

    Installing v3.2.1f4 over v3.3.b7 will not work well if you need side objects at crossing sections. Which version of Unity do you use? That way I can send a v3.3 beta update.

    Thanks,
    Raoul
     
  32. raoul

    raoul

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

    I am not sure, I just tested this on a new 5 marker road. Marker 1, the side object is active on both sides, marker 2 not active, marker 3 active on the right side, marker 4 active on the left side.

    Using similar code as in your post, the active state is returned correctly for each marker. Taking your code I tested this way:

    Debug.Log("Marker "+ i +" active on " + road.GetSideObjectMarkerActiveStateSides(RoadCurbExtension, i));

    Just to see if the problem can be isolated, can you try this on your end?

    Thanks,
    Raoul
     
  33. marcell123455

    marcell123455

    Joined:
    Jun 18, 2014
    Posts:
    275
    Hi raoul,

    Yes it works. It´s silly. I added your line before my if´s and after saving and compiling your and my debugs are working fine. I had this issue with unity a few times now. Maybe something wasn´t initialized correctly in my code. Anyway, it works now.

    thanks ;)
     
    raoul likes this.
  34. marcell123455

    marcell123455

    Joined:
    Jun 18, 2014
    Posts:
    275
    Hey @raoul ,

    how can I get a value from a side objects settings of a road type? (not the settings of the sideobject itself) I want to say: get the X position offset value I set for this side object X specifically for this road type.

    thanks
     
  35. raoul

    raoul

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

    There is currently no option to get this value via the API. But it is a fixed value that is set manually inside the Unity editor. So I would think, getting this value via the API is not really required? It can be added though.

    Thanks,
    Raoul
     
  36. marcell123455

    marcell123455

    Joined:
    Jun 18, 2014
    Posts:
    275
    Hi raoul,

    My plan is to set the side objects position to "my offset" + the original offset value. Maybe I can cache the original offset in my custom Editor script. I could try that. Nervermind :)

    Thanks
     
  37. raoul

    raoul

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

    I will add something like GetSideObjectXPosition(), optionally per marker. Which might be useful anyway. And when this is called after activating the side object on a road object it will return the original X Position inherited from the road type.

    Thanks,
    Raoul
     
    marcell123455 likes this.
  38. marcell123455

    marcell123455

    Joined:
    Jun 18, 2014
    Posts:
    275
    Hi raoul,

    another small issue. When I do SetSideObjectXPosition() it only sets the left sideobjects x position. The right x position is uneffected :/
    Maybe you could add a ERRoadSide enum to the function so I can choose the side?

    thanks!
     
  39. raoul

    raoul

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

    Is the left side the default side for this side object?

    Have you tried this?

    public void SetSideObjectXPosition(SideObject obj, int markerIndex, SideObjectSide side, float value)

    Thanks,
    Raoul
     
    marcell123455 likes this.
  40. marcell123455

    marcell123455

    Joined:
    Jun 18, 2014
    Posts:
    275
    That was what I was looking for. Thanks!
     
    raoul likes this.
  41. joanpescador

    joanpescador

    Joined:
    Dec 21, 2016
    Posts:
    122
    Hi Raoul.
    That will be amazing. I am using Unity v2021.3.1f1.
    Thanks a lot.
    Joan
     
    raoul likes this.
  42. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi @raoul

    i have two different roads connected, and have this glitch !
    Can you help me debug this, I would like to create a slope but it looks like these triangles are stuck to terrain !

    upload_2022-6-2_13-29-6.png
     
  43. joanpescador

    joanpescador

    Joined:
    Dec 21, 2016
    Posts:
    122
    Hello Vagabond.
    This is not an authoritative opinion but I will tell you that, when I have run into this problem, I have solved it, rotating the two connections until they are more or less aligned.
     
  44. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, thanks, i could not do that because of the terrain topology even though it's technically possible.
    The thing is that sometimes it fixed by deleting some of the markers or deleting the connector. I'm not sure when it fixes !
     
  45. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hello @Vagabond_,

    This appears to be a result of the height differences and the middle road marker being close to the connection on the right (about one road width length) and close to the I Connector on the left.

    Lowering the middle marker a little bit and Increasing the distance to especially the right connection will make the height transition smoother.

    And, as Joan mentioned, rotating the crossing on the right a little bit will also help.

    Thanks,
    Raoul
     
  46. marcell123455

    marcell123455

    Joined:
    Jun 18, 2014
    Posts:
    275
    Hi @raoul ,

    I have found an issue with the SetSideObjectXPosition() or maybe GetMarkerCount() function.
    Code (CSharp):
    1.             public void OnRoadUpdate(ERRoad road)
    2.             {
    3.                 ERRoadNetwork roadNetwork = new ERRoadNetwork();
    4.                 SideObject SO = roadNetwork.GetSideObjectByName("SP_Streetlamp_Dualside");
    5.                 for (int i = 0; i < road.GetMarkerCount(); i++)
    6.                 {
    7.                     road.SetSideObjectXPosition(SO, i, SideObjectSide.DefaultSide, 7);
    8.                 }
    9.             }

    This will constantly set the x position for the sideobject at every marker.
    Now moving a marker of a road with that sideobject enabled will create multiple instances of the sideobject! Even when refreshing the road network does not fix the problem.
    Can you replicate this or do you need more detailed instructuions?

    thanks
     
  47. raoul

    raoul

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

    It seems this is done based on callbacks.

    Just guessing, is this resulting in a loop? Why is this side object X position update called after every road object update?

    EDIT: How does the below for line 7 work:
    Code (csharp):
    1. road.SetSideObjectXPosition(SO, i, SideObjectSide.DefaultSide, 7, false);
    false means that the side object will not instantly refresh.

    Thanks,
    Raoul
     
    Last edited: Jun 2, 2022
    marcell123455 likes this.
  48. marcell123455

    marcell123455

    Joined:
    Jun 18, 2014
    Posts:
    275
    Hi raoul,

    I would say too that this could be a callback related loop yes. I thought I could do my adjustment that way, because I wan´t my X pos adjusment done every time after I done a possible change to my road, like enabling a sideobject on a marker.
    So I have to check every marker. Thats why I need that for loop for. Any better solution?

    thanks
     
  49. marcell123455

    marcell123455

    Joined:
    Jun 18, 2014
    Posts:
    275
    Yeah, adding that false does the job.
    Thanks again ^^
     
    raoul likes this.
  50. raoul

    raoul

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

    Good to hear that including the refresh flag indeed works better.

    Maybe the code you posted is not the full code, but when always this value of 7 is used for the X Position it seems a bit of overkill to update this on all markers every time after every road update.

    This X Position value can be set manually in the Side Object Manager, for each side object per road type and for each individual road object in the scene. So this is flexible, there is no need to do this through the scripting API. But again, perhaps more is involved and the code you posted is not the full code.

    Thanks,
    Raoul