Search Unity

EasyRoads3D v3 - the upcoming new road system

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

  1. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    145
    That line along the road is really bothering. I use tga format. How to get rid of it?
     

    Attached Files:

    Last edited: Sep 6, 2019
  2. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619
    Hi unity_c1ndWE1Nn46iPg,

    This does not look like one of the provided materials, you also mention tga so I assume this is your own texture? What is this supposed to look like? Is this about the area inside the red circle or also in front of it? What shader are you using and because the circle is drawn further away, what is the Aniso Level in the texture import settings? Does increasing this solve the problem?

    Thanks,
    Raoul
     
  3. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    145
    I use my own texture with your shader
     
  4. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    145
    Solved it
     
    raoul likes this.
  5. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    145
    Why can't connect with crossroad like the non HD road?
     
  6. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    145
    Used to see a green ball so that I can connect CrossRoad.jpg
     
  7. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    145
    And how can I reduce size of the crossroad to fit with other roads?
     
  8. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619
    Can you give more details how you created that crossroad?

    It appears you created your own road type with your own material. The next step would be to create a matching connection prefab, Road Types > Create New Connection prefab, below the material options.

    The crossing connection will be built according this road type so the width of the crossing will auto match the road type.

    Regarding your other post, the HD Roads crossings are based on imported meshes and use a road shape setup with three nodes. Default built-in road types are based on two nodes. That is why it will not connect to HD Roads crossings.

    Built-in custom road shapes are supported in v3.2 available in betas.

    Thanks,
    Raoul
     
  9. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    145
    Your road mesh with my own texture
     
  10. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    145
    Not like your demo scene, I don't see a connector when I create one. 2019-09-07_005434.jpg
     
  11. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    145
  12. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619
    I am trying hard to follow you as much as possible.

    Can you please provide exact steps of what you are doing?

    Thanks,
    Raoul
     
  13. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    145
    No custom prefabs available. That's why I cannot connect it to crossroad
     
  14. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    145
  15. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619
    Is this still about your new dirt road type? I mentioned that the HD Roads custom prefabs, the prefabs in the red circle in your last image use a 3 node setup. Your new road type is a built-in road type with a 2 node setup. That is why they do not connect.

    If you want you road to work with the HD Roads crossings then try duplicating for example an HD Roads dirt road type and assign your material to it.

    After my previous post I have sent you a PM with an email address, did you see that?

    Thanks,
    Raoul
     
  16. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    145
    Red road is the HD road shader. I only change the albedo map
     
  17. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    145
    I don't use the previous shader anymore
     
  18. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    7,823
    Please remember that this is a support forum and is shared/used by many people. It isn't chat. When seeking support, please provide detailed, clear and well thought out posts. Instead of posting several posts minutes apart, either edit your last post to add information, or plan head a little bit.

    Asset store authors are typically very helpful and willing help you solve your problem. Please return the courtesy by being very clear in what you are asking, provide all relevant information so they don't have to continually ask for more details, and make sure it is related their assets. (for general information or core elements like texturing, please see the learn section);
     
    JamesWjRose, sstrong and hopeful like this.
  19. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619
    Indeed it is not always easy to see what the problem is based on an image and a limited explanation. Meanwhile unity_c1ndWE1Nn46iPg sent a video with the problem. Indeed the feature where connections are directly attached to roads does not seem to work well in the current version, no HD Roads assets are listed. I will check that.

    Thanks,
    Raoul
     
    Last edited: Sep 7, 2019
  20. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619
    This is actually a strange situation that can happen at least in Unity 2018.3.f2 when first importing the HD Roads package and then the EasyRoads3D package. Although the crossing data is available in the prefab in the project folder (looking at it in debug mode) somehow it cannot be correctly accessed. Therefore no HD Roads prefabs will be listed when a road is selected and also, no connections will be visible either after instantiating it.

    If anyone is experiencing similar issues, then please try removing the HD Roads prefabs from /Assets/EasyRoads3D/Resources/custom prefabs/ and reimport the HD Roads package after the full EasyRoads3D Pro packlage is imported.

    Thanks,
    Raoul
     
    Last edited: Sep 7, 2019
  21. forzabo

    forzabo

    Joined:
    Aug 28, 2015
    Posts:
    25
    Hi Raoul -- I'm sorry I did not have time to bundle up the whole scene with the issue regarding the slew of error messages on repaint -- I'm under a time crunch to get this work done. Anyway, although it happens pretty constantly I've learned to work around it, by saving my work constantly and usually deleting the last added object makes it go away.

    But now I have a new problem, I must be doing something wrong --- for some reason terrain deformation is being ignored? (or something) under my crossings. I have Terrain Deformation checked on all my crossing objects. I checked that no Y vreex coordinates are less than 0, and yet I'm getting this result:

    Before Terrain Deformation (road network hidden and shown)

    Screen Shot 2019-09-07 at 3.07.11 PM.png Screen Shot 2019-09-07 at 3.08.09 PM.png

    after Deformation. X's show a few of the resulting "pits" under the intersections:

    Screen-Shot-2019-09-07-at-3.08.34-PM.jpg

    any ideas what I might be doing wrong?

    Thanks,

    --Bo
     
  22. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619
    Hi Bo,

    These are custom connection prefabs based on your crossing meshes. Are thery working correctly now? This is also with regard to generating these white surfaces visible when "General Settings > Scene Settings > Hide White Surfaces" is not checked.

    A good way to see if they are generated correctly isd by moving the crossing upwards, do these white surfaces follow the crossing and snap to the terrain on the outside like for example the built-in X and T Crossings do? If not, are the connections generated in clockwise direction in the Custom Prefab Editor window?

    Thanks,
    Raoul
     
    forzabo likes this.
  23. Marc-Saubion

    Marc-Saubion

    Joined:
    Jul 6, 2011
    Posts:
    279
    Hi Raoul. Thanks for your anwser.

    I Solved the issue. It turned out I had a third party plugin running in the back (gaia spawner) and it refreshed with any minor change. Also my road was 4 km long and that seemed heavy. I split it in shorter bits and it runs fine now.

    I found the shorcuts on this page: http://unityterraintools.com/EasyRoads3D/v3/html/quick_start.html. It seems obsolete. Do you have a more recent website?

    Thanks


    I wanted to disable the updating of the terrain but that's solved. Thanks anyway. :)
     
  24. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619
    Hi Marc-Saubion,

    Glad to hear you figured out what was causing the slow down.

    Regarding longer roads, usually they do already get split in smaller sections by crossings, otherwise they can be cut in shorter sections by inserting I Connectors. That is indeed better for performance then having one long road.

    Thanks,
    Raoul
     
  25. forzabo

    forzabo

    Joined:
    Aug 28, 2015
    Posts:
    25
    Raoul -- Thanks! -- these were the hints I needed.
     
    raoul likes this.
  26. combatsheep

    combatsheep

    Joined:
    Jan 30, 2015
    Posts:
    69
    Hi.

    Please tell me how to put the guard rail at the inside edge of the sidewalk.
    Currently, When I set the guard rail and the sidewalk same time, the guard rail is put at the outside edge of the sidewalk.

    sidewalk.jpg

    Thanks.
     
  27. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619
    Hi combatsheep,

    This can be fine tuned for the side object itself in the Side Object Manager tab (2nd tab from the right). The "X Position" field at the top in "Control Settings".

    The same "X Position" value can then optionally be customized per road in the main "Side Objects" section. These options are available in the foldout.

    Thanks,
    Raoul
     
    combatsheep likes this.
  28. combatsheep

    combatsheep

    Joined:
    Jan 30, 2015
    Posts:
    69
    Thank you, Raoul!
    I make it!;)
    IMG_0009.PNG
     
    raoul likes this.
  29. combatsheep

    combatsheep

    Joined:
    Jan 30, 2015
    Posts:
    69
    Hi, Raoul.

    When I use 'Build Terrain(s)', the height of X- or T-crossing roads are lower than around roads every time.
    The Terrain surface appears on the surface of the X- or T-crossing road...

    TerrainSurface.jpg

    Can I fix it?

    Env:
    Unity 2019.2.3f1
    iMac 2019 mojave (Metal)

    Thanks
     
  30. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619
    That should not happen. In Build Mode:

    1) What is the "Raise Road Network" value in the Inspector?
    2) What is the Y position of the "Connection Objects" child object in the road network hierarchy?
    3) What are the Y position values of the individual crossing objects?

    And which version of EasyRoads3D are you using?

    Thanks,
    Raoul
     
  31. combatsheep

    combatsheep

    Joined:
    Jan 30, 2015
    Posts:
    69
    Hi, Raoul.

    >That should not happen. In Build Mode:
    Yes. It happens after 'Build Terrains', and it disappears when edit mode.

    >1) What is the "Raise Road Network" value in the Inspector?
    0.05~0.1.
    Only crossing roads are not raising.(Spline road is raised normally)

    >2) What is the Y position of the "Connection Objects" child object in the road network hierarchy?
    ex)92.9

    3) What are the Y position values of the individual crossing objects?
    ex)92.9 (same)

    >And which version of EasyRoads3D are you using?
    v3.1.8.f2

    EasyRoads_EditMode.jpg EasyRoads_BuildTerrain.jpg

    Thanks.
     
  32. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619

    Are these values for sure 92.9?

    If the Raise value is 0.1 (which is fairly high). Then the y value of the "Connection Objects" gameobject should also be 0.1, just like for the "Road Objects" gameobject, the parent of all individual road objects. Is that not the case?

    What are these values in Edit Mode for the "Connection Objects" child object? Can you make sure that object is set to (0,0,0) in Edit Mode. Does that solve the problem?

    And how does this work in the main demo scene?

    Thanks,
    Raoul
     
    Last edited: Sep 12, 2019 at 5:01 PM
  33. combatsheep

    combatsheep

    Joined:
    Jan 30, 2015
    Posts:
    69
    Now, I understand what is wrong by seeing the demo scene.

    XCross.jpg
    When I make the crossing road(which is made with customized road type), it is made at outside of "Road Network" Object.

    CrossingWorkFine.jpg
    And I move them into Road Network manually, their surfaces work fine after "Build Terrains"!;)

    I tested that I make the default road in the other scene, the crossing road was made normally.
    So, the Road Network in my current scene is maybe broken.

    Thanks.
     
    Last edited: Sep 13, 2019 at 1:22 PM
  34. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619
    That indeed explains the situation in Build Mode, the crossing will not be raised according the "Raise" value.

    But it is strange, when selecting a crossing prefab in the Connections tab and using Shift + Click in the scene to instantiate it, the object will be placed as a child of "Connection Objects" in the hierarchy. And, in Unity 2018.3+, when dropping a crossing prefab in the scene from the project folder it should also be placed as a child of "Connection Objects" in the hierarchy. There are no known issues with that. So I do wonder how these crossings ended up outside the road network hiearchy on your end? Perhaps this is something to test for this specific road network.

    Thanks,
    Raoul
     
  35. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    73
    Hi raoul,
    I don't fully understand what ERRoad.GetPosition function says in the api manual:
    What does float distance value mean? Is that a value that indicates the distance travelled along the road? In other words is it like the position in cam fly over in the editor? Has a range then?

    Also, the in currentElement is the index of a road marker or what?
     
  36. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619
    Hi 40detectives,

    Yes, float distance value is the current distance travelled along the road, currentElement represents the nearest splinepoint index, it is used for optimization reasons.

    The runtime demo scene / script example, part of the EasyRoads3D Pro package itself, uses the ERRoad.GetPosition function as well. First a road is created at runtime, after that an object follows the road. Have you checked that?

    Thanks,
    Raoul
     
  37. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    73
    Ok I've checking it and now I think I get how it works.
    One question though, I have a vehicle that is controlled by the user, and I want to know at which distance along that road the vehicle it is, to check his position against the center of the road.
    Do you hace any idea how to pass from the Vector3 position of the vehicle to a distance like the one the method is expecting? I'm in the dark here.
     
  38. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619
    The ERRoad.GetPosition function is indeed more intended for AI purposes, moving objects along the roads.

    The scripting API provides access to the spline points, ERRoad.GetSplinePointsCenter(). Or, if you are looking for the position relative to the center of the road, another way could be to create an invisible vertical shape type of side object in the center of the road. Raycast sideways on that side object from the vehicle position and calculate the distance to the hit point.

    Thanks,
    Raoul
     
  39. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    73
    Oh thanks for the idea!

    By the way, is there any way to get the road forward direction at a distance via script? So the objects travelling it via IA have the correct rotation. Being looking in the manual but didn't find anything.

    Also, what does GetMarkerByPoint(int) does?
     
    Last edited: Sep 14, 2019 at 11:12 AM
  40. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619
    Hi 40detectives,
    Can you try ERRoad.GetLookatSmooth(float distance, int currentElement);

    That is used internally, it returns the marker section of a specific spline point index.

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

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    73
    Thanks, it worked! :)
     
    raoul likes this.
  42. tanu1215

    tanu1215

    Joined:
    Feb 8, 2016
    Posts:
    4
    Hi,

    I am struggling to understand how to link roads together with crossings. I am using the recent beta and have read through the example script but for some reason cannot work it out. I am not using the EasyRoads traffic AI system directly, rather the A* pathfinding project for navigation.

    Below, you'll see the situation I have set up. The green lines are custom created links between empty game objects with the tag "Node". I create these nodes with an editor script, iterating through GetLanePoints(). Could you nudge me in the direction towards generating nodes for connections prefabs and linking them as below? I assume I would need a couple more nodes to smoothen out the green line connections, given that they are inherently straight lines.
     

    Attached Files:

  43. raoul

    raoul

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

    The v3.2 AI options is based on lane info defined for road types. This is available on roads and on crossings per crossing connection.

    For crossings you can use:

    ERConnection.GetLaneData(int connectionIndex, int lane);

    connectionIndex is the connection where the road is attached to the crossing. Lane is the lane index which in your case is 0 because there is only one left and right lane.

    This will return lane data in all available directions. In the AI exampl;e ther below code is used. It randomly selects one of the directions.

    ERLaneConnector[] laneConnectors = conn.GetLaneData(connectionIndex, lane);
    ERLaneConnector laneConnector = laneConnectors[Random.Range(0, laneConnectors.Length)];
    Vector3 points = laneConnector.points;

    But I am not sure about the green line linking. With your setup the left and right node on a road also connect, what exactly should this look like on the crossing?

    Thanks,
    Raoul
     
    Last edited: Sep 16, 2019 at 8:46 AM
  44. tanu1215

    tanu1215

    Joined:
    Feb 8, 2016
    Posts:
    4
    Thanks for the response. The nodes on a single road connect from lane to lane so the vehicle can cross over them. For connections, though, I only want the lanes to connect to each other as one would expect. So lanes travelling in one direction would connect to lanes traveling in the same direction only.
     
  45. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    4,619
    Ok, in that case it seems the data should be generated in a similar way as also visible when selecting a crossing, the required green lines should look similar as the white lines in the image below. That is what you should get using the suggested functions in my previous post. Let me know if you have more questions.

    crossing.jpg

    Thanks,
    Raoul