Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

world scale strategy fix #1384

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

world scale strategy fix #1384

wants to merge 1 commit into from

Conversation

brnkhy
Copy link
Contributor

@brnkhy brnkhy commented Jun 3, 2019

change world scale strategy to not include latitude compensation as it's unnecessary in this mode.

latitude compensation is necessary for fixed size tiles where we forces tiles to a fixed value. World scale ar isn't doing any scaling so should be able to use raw height data without any post-scaling.

Closes #1378

@atripathi-mb @jordy-isaac

@abhishektrip
Copy link
Contributor

@brnkhy I don't think this is the right solution. Since Mercator tiles compress distance differently at varying latitudes, the compensation is necessary. However, the scaling applied to the y-axis seems to be the problem.

gameObject.transform.localScale = new Vector3(scaleFactor, scaleFactor, scaleFactor);

This scaling needs to be applied ( to y-axis) for custom Unity Tile but not for World Scale.

@asmccormick
Copy link

asmccormick commented Oct 14, 2019

Thanks for all of your help! @atripathi-mb You're right -- we cannot apply the new scale factor across X, Y, and Z equally -- this will solve one axis, but it will distort the others. We must apply a new scale factor to either the horizontal or the vertical, not both.

Here's my latest solution:

  1. use World Scale with 16x zoom -- this will build maps with very accurate horizontal distances. One Unity unit equals one meter.
  2. calculate vertical scale factor based upon latitude:
    float verticalScale = 1 / Mathf.Cos(Mathf.Deg2Rad * (float)AbstractMapScript.CenterLatitudeLongitude.x);
  3. apply verticalScale to both the terrain and the buildings.

I have a problem in Step 3. It's easy to change Terrain > Exaggeration Factor:
AbstractMapScript.Terrain.SetExaggerationFactor(verticalScale);
But I can't find a method to change Features > Buildings > Modeling > Scale Factor.

Does such a method exist?

@supergra
Copy link

supergra commented Jun 26, 2020

In case someone gets stuck on this, go look at the fix @asmccormick posted on #1378 a few days later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mapbox VR scale is wrong
4 participants