Topic: How to place 3d models in some areas

Can I place some 3D trees on the land? Or place some 3D fish models on the sea? They will randomly spread across these ranges. Can this be done? what should i do

Re: How to place 3d models in some areas

Hello.

The best way depends on two things:
1. How many models you want to place.
2. Whether you know the coordinates of the polygon points of the areas.

If there are not too many models (up to 100-200), it is better to use 3D markers.
Examples of how to create a 3D marker can be found in the atlas of examples.
https://infinity-code.com/atlas/online-maps/index.html
If you have a lot of models, it is better to make a pool of objects and position them on the map using OnlineMapsControlBaseDynamicMesh.GetWorldPosition.
https://infinity-code.com/doxygen/onlin … 6316068362

If you know the coordinates of the polygon points of the areas, good.
If you don't know them, you can find them using OSM Overpass API or get them from vector tiles.

When you have the point coordinates of the area polygons, you need to find a point within the polygon to place a marker or GameObject.
I would do it this way:
1. Find the bounding box for the polygon.
2. Got a random position inside the bounding box.
3. Using OnlineMapsUtils.IsPointInPolygon checked that the point is inside the polygon.
https://infinity-code.com/doxygen/onlin … 85a199078b
4. If it is inside the polygon, create an object.
5. Repeat from step 2 the required number of times.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: How to place 3d models in some areas

I see your point. But I would like to ask is there any way to get the vector tiles of mapbox? Are there any examples or documentation I can look at?

Re: How to place 3d models in some areas

I have an unfinished script that works with vector tiles (attached).
Hope this helps to understand how to download and read them.

Thanks for your question.
I saw that I didn't make some simple example of working with vector tiles, and I will try to add such an example in the next version of the asset.

Post's attachments

Attachment icon VectorLabels.cs 18.82 kb, 49 downloads since 2023-08-23 

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: How to place 3d models in some areas

Thanks.
Looking forward to your example.

Re: How to place 3d models in some areas

hello, I find that there is a question that I didn't find a way to get the vector tile of a specific tile using mapbox

Re: How to place 3d models in some areas

Unfortunately, I didn't understand your question.
Please rephrase it.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.