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
    @40detectives

    I just tested this using the runtime script example. First I made some changes, added a road network to the scene and created a simple side object, just a cube spawned every 5 units. This side object was activated on the "Default Road" road type. In the runtime script this road type is used. road.GetRoadTypeByName("Default Road");

    Then in Update():

    road.SetMarkerPositions(markers);

    Where the position of one of the markers was changed. The road updates, no errors are thrown. So I am not sure at this moment how to replicate the error.

    However the error message by itself is clear. I did a search for DestroyImmediate() involving side objects and made some changes. Which version of Unity do you use? I can send an update so you can test if that indeed fixes the error.

    Thank you for reporting this!
    Raoul
     
    40detectives likes this.
  2. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    The error stated:
    Try to call
    road.SetMarkerPositions(markers); 
    inside a OnTriggerEnter/OnTriggerExit/Etc method (as in my case) or OnValidate.
    While was doing that, I also tried yesterday with a new sideobject which was basically a decal from HDRoads (so I mean no further config or components on that gameobject), and it also returned the error in the console, one for each instance of the sideobject along that road.

    Unity 2019.1.9f1. Sure I can test it, deferring the SetMarkerPositions() till the physic event ended seems to work well, though.


    By the way, out of curiosity, was there any reason why you used DestroyImmediate() instead of Destroy()? For what I've found DestroyImmediate() is used more commonly with Unity Editor code, and Destroy() at runtime.
    From the script reference:
     
    Last edited: Jul 14, 2019
  3. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    I will send an update tomorrow for Unity 2019

    EasyRoads3D is primarily a Unity editor tool, the same code is used for side objects generated at runtime. I added some code to make sure Destroy() is used when necessary. This is indeed more important with the recent v3.1.8 update including more side object control at runtime through the scripting API.

    Thanks,
    Raoul
     
    40detectives likes this.
  4. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Btw, I'm trying to export a Road to another project, but I can't figure out how to do it... Not a road type, I mean a road object inside the road network hierarchy.
     
  5. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi 40detectives,

    Do you mean a road network or a single road object?

    In general, unity stores generated objects such as the road mesh in this case by default in the scene file. The easiest way to copy a road network to a scene in another project, is by:

    1) Load a second empty scene in the hierarchy in the original project
    2) Drag and drop the road network object in the hierarchy in the empty scene. Only save the empty scene, that way the road network will still be part of the original scene as well after reopening that scene.
    3) Export the empty scene with only the road network object to a Unity package including all dependencies.
    4) Import this package in the other project
    5) Open the scene and drag and drop the road network object in the hierarchy to the scene where it is needed

    The same processes could be followed for a single road object, only export that road object. But I assume you work with road types? In that case, does that road type exist in the other project? Both road types and side objects can be exported separately and imported in other projects.

    Thanks,
    Raoul
     
    Willbkool_FPCS likes this.
  6. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Hi! thanks for the thoughtfully explanation. I meant a single road object, but in this case the network only has the road to be exported so I can easily do it with that network too.
    Not sure how to accomplish that part, you mean by creating a prefab of the Road Object/ Road Network in the assets folder first and then adding it to an empty scene; or maybe using the option of "Export Object" in that Road Network Scene Settings:
    ER3D_road_network_export_object_option.png
    Because that button only exports an "inmutable" mesh (.obj file) with the shape of the road, right?


    Does that mean that I also need a matching terrain to be exported? Got tons of errors in console when adding a road/road network from a prefab to an empty scene.
     
  7. raoul

    raoul

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

    In 2) both the original scene (A) and the empty scene (B) are available in the hierarchy. You can simply drag the road network object from scene A to B in the hierarchy. The advantage of this approach above creating a prefab is that the road network object remains exactly as it is, also later at step 5)

    The "Export Object" option exports the road to .obj, I think that is not what you want in this case.

    This is road network object only, there is no need to include the terrain in the empty scene. And no prefab is involved here. Simply drag the road network object in the hierarchy from scene A to B and only save scene B if you still need the road network in the original scene A.

    Also, after your additional info, if you already have a road network object in the target scene with the same road type. Then you can simply drag the specific road object only to that road network instead of the full road network object.

    Thanks,
    Raoul
     
    40detectives likes this.
  8. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Hi Raoul,
    Is there a way to get the roads connected to an ERConnection? I.e. a function like
    public ERRoad connection.GetConnectedRoad(int index) and
    public ERRoad[] connection.GetConnectedRoad()

    GetConnectionData() seems to go into that direction, but there is no documentation I could find about the ERConnectionData datatype.


    EDIT:
    Found the answer myself. Found out that ERConnectionData has fields road, marker, position and connectionindex. Which is good enough for me to work with. Maybe you can expand the documentation in that regard?

    Kind regards,
    Christian
     
    Last edited: Jul 16, 2019
  9. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735

    Hi Christian,

    The current public version v3.1.8 includes various undocumented methods used in the v3.2 beta available on our website. Another option is:

    public ERRoad GetConnectedRoad(int index, out ConnectedTo connectedTo)

    ConnectedTo options are: Start, End

    This is used in the 3.2 AI example script to find if the attached road starts or ends at this connection.

    Thanks,
    Raoul
     
  10. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Ok, I've just discovered the Multi-Scene editing feature of Unity. My apologies.
    ----

    I don't know if this is an issue of ER3D or maybe more Unity side related, but exporting a road / road network to another project is incovenient to say least. Let me explain it, when doing the step 3:
    When including all dependencies, it is inconvenient because Unity by default suggested to export almost all the old project (like all scripts, and not related textures). Even editor plugins and the EasyRoads3D dlls, which were from v3.1.7 in the old project and 3.1.8 in the new, so it would be kind of a headache trying to fix the folder structure after importing a road from other project and having to re-import up-to-date versions of all the plugins.
    Because of that, I selected in the exportation interface only the objects relevant to that road (textures, materials, models for sideobjects & prefabs for such models).

    Then, after completing step 5, I think I've found an issue:
    If you try to select a road marker, you can't select them, it will switch and select the road object children instead when trying to do it. And the markers disappear every time you change the focus from the Road Network so is sort of playing cat and mouse game.
    At the same time a bunch of errors are thrown to the console each time the mouse hovers the road network with it selected in the hierarchy. These are the errors thrown to the console:
    ER3D-errors-importing-road-from-other-project.png

    After messing a lot (kinda clicking everywhere), I fixed it but not sure what really did, made a few test before posting and although I'm not sure of the solution, the error I can replicate it.

    This bug happens when exporting a road object, exporting the whole road network seems to work fine besides the inconveniences when exporting with all dependencies.
     
    Last edited: Jul 16, 2019
  11. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi 40detectives,

    I mentioned to include all dependencies assuming you want to include all additional assets such as road material(s). For EasyRoads3D specific road info it is not necessary to include all dependencies, that is all stored in the scene file. In any case, I would think that what you describe also applies when you would export it as a prefab? How is that different? Which part is inconvenient?

    Regarding the error, we have moved road objects between road networks many times without issues through the steps I mentioned. That is why I suggested that as an option also for a single road. As long as the road is not attached to a crossing there are no dependencies. The only thing that is important, I mentioned that before, is that the road type used on that road is also available in the new road network object.

    I just checked this in the demo scene using the "Default Road" road type:

    1) I added a new scene A with a new road network object and added some roads
    2) I created an empty scene B and also loaded scene A
    3) I dragged a single road from scene A to scene B and saved scene B (with only a road object)
    4) Opened the main demo scene with the small road network and also loaded scene B in the hierarchy
    5) Dragged the road object from scene B to "Road Network > Road Objects" in the main demo scene and selected this Road Network object

    The markers show as expected for the specific road, are selectable and can be moved around, the road does update. There are no errors

    In this setup the road types between the different scenes are the same. The error message you posted shows a problem in ERModularRoad.GetRoadsWidth(). This is road type related. Does exactly the same road type of the road you imported exist in the new scene? If not, is it possible to select another road type from the "Road Type" dropdown or is the road not selectable at all?

    Thanks,
    Raoul
     
    Last edited: Jul 16, 2019
  12. Jbs_GameZone

    Jbs_GameZone

    Joined:
    Dec 14, 2018
    Posts:
    118
    Hello,

    Is there a way to add side objects only for the current selected nodes ?
    By default it adds the side object to the entire road. A workaround would be manually delete the objects from the hierarchy and leave only the ones I need, but this doesn't work for example for Powerline wood single, while I can delete the poles, the entire wire remains.
    I could split the road (I Connector) into multiple segments but I'd rather leave it in one piece to keep the draw calls low. That's why I'm curious if there is a way to generate the sideobjects only for a bunch of consecutive selected nodes.

    Thanks
     
  13. raoul

    raoul

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

    In general side objects can be activated / deactivated per marker. When side objects are activated on a road there will be a new section "Marker Side Object Settings" below the general markers section in the Inspector. One of the activated side objects can be selected from the dropdown, below the dropdown, among others, there is an "active" checkbox.

    Additionally, when side objects will only be used on a selection of markers it is much more efficient to activate the side object for these markers then having to deactivate them for all other markers:

    Side Object Manager > General Settings > Default active state for each marker

    This checkbox is toggled on by default. Switching it off will initially result in visually nothing happening after activating this side object on a road. After that it can be activated for those markers where it should appear. Holding the Shift key can be used to select multiple markers. The side object will be activated for all selected markers.

    But maybe there is more to your question since you mention "Powerline Wood Single", which sounds as if it is the powerline example from the free additional demo package. Are you using this side object attached to a road object? That is possible but you could also create a new "road type", mark it as "Side Object" so no road will be created. Instead activate the "Powerline Wood Single" side object for this new "road object". New power line only objects can now be generated quickly by selecting this new "Road Type" from the dropdown in the second tab from the left, the "Add New Road / Object" tab. With that setup the side object should always be active on all markers along the full spline shape.

    Thanks,
    Raoul
     
    Last edited: Jul 17, 2019
    Jbs_GameZone likes this.
  14. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Hi Raoul,
    Thank you for your help!
    I am currently looking at generating roads with a script. If I create a road network manually, I get presented with a dialog asking me if I want to import road presets. If I click yes, I have access to my created roads.
    However, if I create a new road network with a script (and none exist in the scene), I can only access the default road. Is there a way to trigger the import of road presets in a script? I looked at the methods provided by ERRoadNetwork, but there did not seem to be a suitable method. I also tried to look at the EREditor class, but it does not seem to exist (though it is referenced by the documentation).

    Kind regards,
    Christian tmp.png
     
  15. raoul

    raoul

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

    The road type and side object presets that can be imported when creating a new road network object are not available at runtime. New road types can be created through the scripting API.

    But what you you can do is already setup the road network object manually in the scene including all needed road types and side objects. In your script the ERRoadNetwork constructor will reference the existing road network object. All road types and side objects will be available.

    The EREditor class is currently limited to getting access to the selected road in the scene view window:

    ERRoad road = EREditor.GetSelectedRoad();

    This can be used to create additional Scene View functions if you would want to.

    Thanks,
    Raoul
     
  16. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    Sorry if I misspoke, still quite a novice at unity and a bit unclear about the vocabulary. The script I am writing is an editor script, so I do not need access to the road network at runtime.
    Even in an editor script it is not possible to have ER import the available roadtypes?
     
  17. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    That is correct, project road types are currently only available when adding a road network object manually to the scene.

    Is the workflow I suggested not an option? The road types and side objects will be available. It can be added to the scripting API as well if you would prefer that.

    Thanks,
    Raoul
     
  18. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    The suggested workflow works for me, I will just need to add a huge message for myself somewhere so that I won't forget about it.
    Thanks for your help.
     
  19. Thomas-Pasieka

    Thomas-Pasieka

    Joined:
    Sep 19, 2005
    Posts:
    2,174
    Hey again @raoul

    I noticed that in one of your videos there are several features that are related to updating/saving/etc of the Crossings. In newer version of Unity prefabs are handled a bit differently so how should I go best about "saving" them? What I currently do is to locate the prefab and edit it using "Open Prefab" which opens the prefab in a different scene which seems to be super dark (see video). Is this a known bug or am I missing something?

     
  20. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    I made a note to add this to the scripting API. Personally I belief the suggested workflow is easier, but obviously I don't know the nature of your project. Perhaps you want to fully automate specific processes.

    Thanks,
    Raoul
     
  21. raoul

    raoul

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

    In Unity 2018+ source prefabs in the project folder can be edited through the new prefab editor. I think that is what you did. It is the Unity prefab editor, the lighting is indeed different, but it looks the same for other prefabs on our end. Do you notice a difference?

    [Edit]I saw the end of the video, that is dark! I will post an image in a minute

    Thanks,
    Raoul
     
  22. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
  23. Thomas-Pasieka

    Thomas-Pasieka

    Joined:
    Sep 19, 2005
    Posts:
    2,174
    Hey again,

    Yeah every prefab I created like a Car, etc will show just fine in Prefab Edito mode. Any EasyRoads related Prefab will show up black/dark.

    Edit: Nevermind, seems like it's working now. I created a new "Prefab Editing" scene and now it's working as expected.
     
    raoul likes this.
  24. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Maybe is because I created a new Road Type with the same name and same values than in the old project instead of exporting the Road Type with the EasyRoads option?
     
  25. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi 40detectives,

    That will indeed not match the original road type in the other project which will have another ID. This ID is used to keep road types with the same ID in synch across different scenes also when the road type name has changed.

    If you exported the full road network in the empty scene, then after opening this scene in the new project and selecting the road network object in the hierarchy, this road type will be added to the project road types. The road type can then be added to the road network in the scene where this road is needed through General Settings > Road Types > Add Project Road Types

    Thanks,
    Raoul
     
    Last edited: Jul 17, 2019
    40detectives likes this.
  26. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    243
    Is there an easy way to lay all existing roads right on the terrain, maybe offset by a small amount? I imported from an Open Street Map export onto a terrain that was constructed from real-world height data. The problem now is that in most cases the markers appear to be exactly on the terrain and for many of them the intervening road itself ends up under the terrain and therefore invisible.

    If I go into build and set "Raise Road Network" to about .65 that takes care of all the issues, but now many sections of the road are 65cm above the terrain, while some are directly touching. Also, I'm unable to edit, and returning to edit mode returns the roads to hiding under the terrain. I have disabled "update heightmap" because the data I used already has the depressions of the existing roads and allowing ER3D to update it caused numerous undesirable height artifacts in my terrain.

    Any suggestions? At the moment I've resorted to toggling off rendering of the terrain while working with the problematic roads.

    UPDATE: I found the follow terrain contours, and that helps a lot. I suppose I'm going to need to just do a lot of hand clean up. Still, easier than drawing them out one-by-one. I think :)
     
    Last edited: Jul 18, 2019
  27. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    243
    Bug (v3.2.b6): when roads auto-snap together (when you drag a marker and drop it too close to another marker), undo does not restore to the pre-joined state. I've had to resort to saving after every single edit so if it happens (and it's happening a lot because my roads are very close together due to OSM import) I can exit without saving and re-open the project to get back to the pre-joined state.
     
  28. raoul

    raoul

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

    Yes, indeed "Follow Terrain Contours" with the desired threshold value will do that. I see this is not yet part of the Road Type settings, this will be added. It will make things a little bit easier for OSM imports.

    Thanks,
    Raoul
     
    colin_young likes this.
  29. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Is this indeed specifically related to roads snapping close to another marker? Or roads snapping together in general?

    And which version of Unity do you use? For example. The tool still works on Unity 5.6. After snapping roads the inserted crossing prefab will be auto selected to quickly fine tune the crossing position / rotation. The Unity Undo class is used for all Undo performances. Somehow Undo indeed does not work straight after snapping markers at least for Unity 5.6. However, it does get triggered after deselecting the crossing prefab. Snapping roads is undone.

    Testing this in for example Unity 2018.3, Undo instantly removes the inserted crossing prefab and restores both involved roads to their initial state. Also when dropping the road exactly at a marker position of the other road.

    Do you see something similar or is your situation different?

    Thanks,
    Raoul
     
  30. PhilipZ0

    PhilipZ0

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

    I have a question, how to create simple 3,4,5 lane road via scripting? Can you give the simple example via API how to get that and set up the guardrail as side object and width of lanes for example? I have the latest version, but only managed to dynamically create single lane or 2 lane roads. I watched the videos but didn't notice the example of creating multiple lane roads/highways. Thank you!

    I would need something like in this video 3 lane road.
    .
     
    Last edited: Jul 18, 2019
  31. Bartosz-Bieszka

    Bartosz-Bieszka

    Joined:
    Sep 12, 2015
    Posts:
    20
    Hi Raoul,
    I have only question, when will be available version with flex connector?
     
  32. christian-l

    christian-l

    Joined:
    Jul 11, 2019
    Posts:
    24
    You can download the beta version from the website, it contains some flex connector support.

    Hi Raoul,
    I am really enjoying the lane features of the current Beta! However I can not visualize them automatically. In Settings > Scene Settings there is a "Display Lane Data" Toggle, but it does not do anything for me. I tried the AI demo scene and it does not work there either.
     
    Last edited: Jul 18, 2019
    raoul likes this.
  33. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    243
    I'll need to double check the version. It's either 2019.1 or 2019.2 beta (I'm trying to use the new Input System, among other new features). Perhaps it's an issue with 2019 vs. 2018. I think I did see some instances of undo working, but it's been inconsistent. I do see the crossing snapping undo working, it's when roads get snapped together, e.g. I am trying to adjust the position of one of the roads in an intersection before adding the crossing, and the end of the road snaps to the sidewalk beside the road. I'll have to try to get my terrain exported to try it in 2018.

    I am seeing a number of other issues that I'll need to test out (I gave up in frustration very late last night). Things like roads connected to a crossing suddenly looking like they're doing a "corkscrew" flip at the connection, flex connectors not working as shown in the video, etc. I do realize I'm a bit on the bleeding edge here (ER3D beta, Unity Tech stream - maybe even beta), and I'm a little concerned that maybe my terrain scale is contributing, so I'm going to try and test out in 2018 before reporting any of those issues. I'd also like to test it "clean" without the OSM import in case the high density of roads is contributing.
     
  34. raoul

    raoul

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

    Which example of creating multi lane roads are you referring at?

    In any case, this can be done either by using a material with a road texture with multiple lanes or by using an asphalt only texture and add the lines using side objects similar like in the HD Roads video second video starting at 2.00. The trick here is to add more line marking side objects with different X Position values, one per lane.

    Eventually it will also be possible to also create roads with any number of lanes in the road type settings, but that is currently not yet supported.

    Thanks,
    Raoul
     
    PhilipZ0 likes this.
  35. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Hi Bartosz-Bieszka,

    I just replied to an email I received from you. The Flex Connector is indeed part of the v3.2 beta available on our website.

    Thanks,
    Raoul
     
  36. raoul

    raoul

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

    Just in case, the lane info currently only shows for the selected road, selected crossing. Or do you have a road / crossing selected?

    I just double checked this in the current v3.2 beta scene. The lane info does show with a road or crossing selected, and switching On/Off "Display Lane Data" in General Settings > Scene Settings does update the road network.

    Is the lane data actually available? Is Generate Lane Data activated in General Settings > AI Traffic? Have you tried select a connection prefab and in the Inspector press: Traffic Lane Info > Reset Lane Connectors

    Thanks,
    Raoul
     
  37. raoul

    raoul

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

    Flex Connectors is v3.2 beta related. http://unityterraintools.com/v3beta.php This page includes some limitations, known issues. Important for the Flex Connector is that the road type is updated to v3.2. This should be done automatically, but one way to force this is by selecting the road type in General Settings > Road Types and change some settings, for example add lane info. Depending on the nature of the material the road type shape also may need to be set like shown in the initial v3.2 introduction video. Or are you using the default road type part of the package?

    If you see different issues please me know, that will be much appreciated. I will double check this in unity 2019 and see if Undo behaves different.

    Thanks,
    Raoul
     
  38. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    243
    I was using the default road type, but also some new types I created (mostly by duplicating the default, then updating the width, material, etc.). Pretty sure I've tweaked settings on the road types, but can't guarantee that. I've switched back and forth between the 3.2 beta and the 3.1 releases several times. I might just remove the entire thing and re-add ER3D (since it's all imported roads from OSM and I've only managed to do one intersection, it's not like I'm losing any significant amount of work). I'm also going to do a matrix test of 3.1 and 3.2 against 2018, 2019.1 and 2019.2 tonight with a simple flat terrain and nothing else. I'll report those results back, but I'm beginning to think it might just be accumulated crud in my project.
     
  39. raoul

    raoul

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

    Earlier today I tested the v3.2 beta in 2019.1 using the beta demo scene. Undo after snapping roads worked instantly after the first Undo, also when snapping roads near a marker. That was when snapping the first or last marker to the other road resulting in a T crossing being inserted. Then I tested snapping a middle marker, this results in errors. Undo does work but requires several Undo's to get both roads back into the original state. I will look into that. Is that perhaps what happens on your end as well?

    Thanks,
    Raoul
     
  40. PrimusThe3rd

    PrimusThe3rd

    Joined:
    Jul 3, 2017
    Posts:
    69
    Hello, can someone please guide me to make a bike lane like this...
    Many thx :)
    Primus
     

    Attached Files:

  41. raoul

    raoul

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

    The image shows a bike lane surrounded by grass that by itself can be done by creating a new road type with the bike lane material. Can you explain a little bit more what this should look like? Should this be a bike lane parallel to a road? In that case, are crossings involved? What should this look like on crossings?

    Thanks,
    Raoul
     
  42. PrimusThe3rd

    PrimusThe3rd

    Joined:
    Jul 3, 2017
    Posts:
    69
    Hi.. thanks for a quick response. :) I just need a bike line (new road type) with integrated bike icon texture on it... Is this icon automaticlly appeared after set distance?... Let's say on every 1km there should be a bike icon texture... Best regards.
     
  43. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    The bike icon texture can be added automatically as a decal through the side object system. A "Mesh Object" side object where the interval between the bike icon texture can be set though "Distance between Objects". If you need to know how to setup the bike texture as a decal, the free demo package and the HD Roads package includes various decal examples.

    Thanks,
    Raoul
     
    PrimusThe3rd likes this.
  44. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    243
    I also tested ER 3.2.b6 in 2019.2 and it worked perfectly. Mostly. I was able to get it into a non-undoable state by dragging the roads around to the point that they "broke" the mesh (it was all messed up and part of it ran 100s of units off to the right), but that's kind of expected for a new feature in a beta and a bit of an edge case.

    From my project i removed all the EasyRoads 3D assets (the base, HD Roads, sample scenes)and the road network, then saved and re-started Unity editor. I re-imported the 3.2.b6 package (2018.3 and newer), then re-imported my OSM. The undo was working more reliably, but I'm seeing a large number of arrays out of bounds exceptions. I haven't yet tested to see if I am getting those before adding ER3D back in, or if it's only after editing or something. I'll pay closer attention tonight. They may not even be related.

    What I am seeing though, is the flex connectors do not work at all in my project, anywhere, even in a different scene. They work exactly as demonstrated in the video in a new project, in the project I'd like to use them in they show the per-connection editor controls, but do not resize according to the selected road type nor do the angles of connection change (i.e. the geometry is fixed). At this point, the only other variable is MicroSplat, so I will be adding that to my test matrix tonight. I will also be testing my heightmap/terrain generation in a new project to eliminate that as a possible cause. My terrain source heightmap originated from a 512x512 file, scaled to 2049x2049 with gdal utilities and then imported to Unity and scaled to a terrain of 2159.9x2159.9 units. I'm guessing it's possible that introduced some artifacts that are causing problems for ER3D.
     
  45. raoul

    raoul

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

    Indeed the Flex Connector is still being developed but I am not sure if this is a known issue. How can this be reproduced? What does this look like?

    When exactly does that happen? How can this be reproduced?

    In order to isolate the issue what type of roads are involved and which steps do you take? For example, in the first v3.2 beta it was only possible to convert an existing X or T Crossing into a Flex Connector and only when roads are attached to all connections. Is that how you create the Flex Connector? In that case, is the original X or T crossing setup in a way that all connections have the same road type assigned as the connected roads?

    In the current betas it is also possible to start a new road from an existing road, this will instantly insert a Flex Connector. This involves more processes. Is this what you are doing?

    Since you mention this does work in a new project, not in an old project it seems as if this is road type related. Would it be possible to have a look at a simple project with your road type setup? Could you email a link in that case, or start a private conversation?

    Thanks,
    Raoul
     
  46. bakanekofr

    bakanekofr

    Joined:
    Feb 28, 2014
    Posts:
    122
    Hello @raoul ! I have 2 questions:
    - I'm positioning a game object on a road using the road.GetPosition(distance) thing. Is it possible to get the angle of the road at that distance so that the game object will be always facing as it should?
    - The GetPosition(distance) return the center of the road position only. Is it possible to have a position at any offset from center on the road at that distance?
    Thanks !
     
  47. raoul

    raoul

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

    To get the forward facing the direction of the road you can use:

    road.GetLookatSmooth(float distance, int currentElement)

    currentElement refers to the nearest spline point. The following methods return the spline points on the left side and the right side of the road.

    ERRoad.GetSplinePointsLeftSide()
    ERRoad.GetSplinePointsRightSide()

    So something like this should work

    Code (csharp):
    1. Vector3[] leftPoints = ERRoad.GetSplinePointsLeftSide();
    2. Vector3[] rightPoints = ERRoad.GetSplinePointsRightSide();
    3. Vector3 pos = road.GetPosition(distance, ref currentElement);
    4. Vector3 dir = (leftPoints[currentElement] - rightPoints[currentElement]).normalized;
    5. pos += dir * offset;
    Thanks,
    Raoul
     
    dav-id likes this.
  48. bakanekofr

    bakanekofr

    Joined:
    Feb 28, 2014
    Posts:
    122
    It's working, Thanks!
     
    raoul likes this.
  49. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    243
    I'm definitely not starting a new road from an existing road. I have no idea how to do that :) I'm simply adding a new T- or X- connector, dragging out the roads from there, then converting to flex. At that point (with the road left at "default") it doesn't "flex". I have a video showing some issues I encountered in a clean project, but I did not get into a state where I could not undo anything. The issues are due to forcing the connector into an angle that is too small.

    I created a new project, added terrain, imported my heightmap and added Microsplat and tested there with no issues.

    At this point I'm inclined to blame random project corruption, likely due to having gone through several beta releases and switching between versions of ER3D. I have it hosted with git on Azure, so if you'd like to take a look at it, I can add you as a user. If you're interested, I'll email the details.

    At this point I'm inclined to start from scratch with a clean project. It seems like less work than trying to fix things, and will probably avoid other issues I'm not even aware of.
     
  50. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,735
    Without the road being selected move over the existing road where the new road should start. Press Shift + Left Mouse Button. A blue handle will be visible when this is a safe position to start a new road. At this moment the Shift key can be released. Drag away from the road in the direction where you want to create the new road, the road will appear. After releasing the mouse button the Flex Connector will be inserted.

    There is indeed a limit in the angle between the two roads. This is being worked on. In one direction this limit is enforced resulting in the Flex Connector simply only being updated when the angle is larger. On the other side where the limit is not enforced, the triangulation will look wrong on smaller angles. This happens at reasonably sharp angles smaller then around 30 degrees or so.

    Please let us know if you still see the other issues in the new project, that would be very much appreciated. It will help improving the 3.2 betas :)

    Thanks,
    Raoul
     
    colin_young likes this.