Borders and middle of roads
Hey guys, how can I identify the middle and the borders of roads. Thanks Note: If this is a bug or support ticket, please provide the following information:
- Unity version:
- Scripting Runtime Version:
- Scripting Backend:
- Api Compatibility Level:
- Mapbox SDK version: 2.0.0
- The platform you're building to:
- A description of what you're trying to do:
- Steps to recreate the bug if appropriate:
- Links to your logs are also helpful:
Hey @roura-12, I'm not exactly sure what you mean but road data is structured as a list of Vector3 so you can calculate middle of it. LineMeshModifier does the line extrusion/thickness stuff and you can find about road edges there as well. In general I suggest checking LineMeshModifier.
Thank you I will test that and share the result. Another question plz, is there a method to know the roads ids or geographical position as is the case for buildings in replace feature modifier: it is useful for adding objects like cars, bicycles on top of specific roads or on the edges of specific roads (e.g lights): those are the use cases that I'm working on now. Thanks again
@roura-12 hmm that's an interesting question. I'm pretty sure roads doesn't have unique ids. Streets v8 has road names/text, that might be a somewhat unique id for finding a spesific road you're looking for. Other than that all I can think of is keeping track of them by latlng of their first vertex I guess. Would be harder if you're planning to add meta data (which roads gets what) from an outside source but should be easier if you're planning to do it in unity as you'll get the first vertex by default anyway. (i.e. select road in unity app, get first point info, save to database with that point and car/bicycle info on it, next time loading same tile check database for that latlng, if exists visualize car/bicycle info on it)
thank you I will try it ; but the buildings and roads have ids at run time ; if we can use the buildings ids in replace feature modifiers then there is a way to use the roads ids also; what do you think about that @brnkhy


@roura-12 admittedly I wasn't aware we extended unique ids beyond buildings 🤦♂ but still I'm not sure if they'll work properly with roads because of how data is structured. Streets tileset merges similar features together to optimize data size so you'll probably end up with stuff like this frequently;
but then you probably would have the same problem with first vertex anchor idea as well 🤔
I am using spawn on map to add objects like lamps however they aren't placed exactly on roads sides so I probably should get the roads coordinations to place them; and as you know I should have 2D map to use that; The other solution is that I add objects as POI in mapbox studio then I import the map to unity thank you if you have any other ideas plz tell me thanks again :)
@roura-12 I think SpawnOnMap might not be a good place to do it.
If you can do it on mapbox studio and import as you said (I mean enter all that data by hand), that would easily be the best solution at the moment. So if we're talking about 10-20 static objects, I would suggest doing that. But of course you can't do it for big numbers/areas etc.
I think a custom mesh modifier might be the best option here. and changing line mesh modifier maybe but either way it'll be pretty difficult I'm afraid :(