wrld3d / unity-api

Issue tracking for the WRLD Unity SDK
28 stars 8 forks source link

Distance to position, broken? #84

Closed MephestoKhaan closed 3 years ago

MephestoKhaan commented 6 years ago

I think the "distance" calculations are not working when the map is scaled. If I mesure the distance from the camera to the center of the map I get a value X, but if I get the distance from the camera to something that is actually closer but not centered, the distance is sometimes higher.

I am doing this

LatLongAltitude currentCoords = Api.Instance.CameraApi.WorldToGeographicPoint(Camera.main.transform.position, Camera.main);
double distance = LatLong.EstimateGreatCircleDistance(targetCoords, currentCoords.GetLatLong());

if (distance > jumpDistanceThreshold)
{ 
// recenter map
}

And if I scroll manually, without centering the map, to targetCoords until I am sure I am at < jumpDistanceThreshold and then run this code the distance is huge

MephestoKhaan commented 6 years ago

I tried something similar converting the targetCoords to Vector3 with the CameraAPI and I see similar results.

johnbell84 commented 6 years ago

Hi MephestoKhaan,

Thanks for trying WRLD, and thanks very much for the issue report.

We're investigating some issues to do with applying Unity transforms to our maps at the moment. We'll update this issue with more information when we can, but in the meantime, I'd suggest leaving the maps unscaled as a workaround, if that's possible for you.

I hope this helps, best of luck with your project.

Kind regards,

John

MephestoKhaan commented 6 years ago

Thanks! Impossible at the moment sadly as I am using for AR purposes and really need it scaled. Do you have an ETA?

On 23 May 2018 at 09:35, johnbell84 notifications@github.com wrote:

Hi MephestoKhaan,

Thanks for trying WRLD, and thanks very much for the issue report.

We're investigating some issues to do with applying Unity transforms to our maps at the moment. We'll update this issue with more information when we can, but in the meantime, I'd suggest leaving the maps unscaled as a workaround, if that's possible for you.

I hope this helps, best of luck with your project.

Kind regards,

John

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wrld3d/unity-api/issues/84#issuecomment-391266637, or mute the thread https://github.com/notifications/unsubscribe-auth/AEvwqn6e2XILHK0erEOR_MZjMMeVqkzQks5t1R9fgaJpZM4UCxBB .

deadbytedawn commented 6 years ago

@MephestoKhaan You could try turning on the terrain collision and cast a sphere: https://docs.unity3d.com/ScriptReference/Physics.SphereCast.html

ghost commented 3 years ago

Believe this is now resolved in release v0.8