Scale Map to Real World Dimension and Camera Zoom Using C# and Mapbox API in Unity

preview_player
Показать описание
This video provides a C# script that changes the size of the map automatically based on the distance from the camera and real-world measurements.

It shows how to scale Mapbox map so that every unit in Unity equals one meter in the real world.
It calculates the map width and height in meters based on the size of a plane that fills and matches the game view in Unity. Then, translate the width and height to the bounding box parameters of Mapbox Static Images API to define the map borders using C#. The result is a map where each unit in Unity equals one meter in the real world.

This is useful in applications with architectural and real-life implications where the scale to the real world matters.

Mapbox offers a free tier for each product, which allows you to use the API for free within limited requests per month.

Mapbox pricing:

Get started, create an account if you don’t have one or log In.
Log in, + Create a token if there is none, Write a name, Create token.

Mapbox API Docs:

Static Images API playground:
Рекомендации по теме
Комментарии
Автор

Big respect to you for explaining the code in the way that you do.

saadafm
Автор

I applied both of your scripts but my map do not change its bound and do not zoom in or out by changing camera y

songs-ezrz
Автор

Man!! thanx! I ´m using this google maps api in my proyect. Can it shows another localitations in map, i have new coord fronm another device? Thanx!

AlexVerdugoOFICIAL
Автор

Do you have the full script for this? I hope you can reply asap.

ifnxsyh
Автор

How can I place markers directly on the map?

HiroCutes
join shbcf.ru