When moving in the real world, how to convert speedmeterspersecond into pixels in the unity world?
When moving in the real world, how to convert speedmeterspersecond into pixels in the unity world?
I don't know how many pixels are moved in the unity world by moving one meter in the real world?
Thanks.
found this some time ago in a thread:
///<summary>
/// Temporary hack to calculate the multiplicator which needs to be applied to spawned gameobjects
/// to match the actual tile size.
/// </summary>
/// <param name="targetPlayerPos">WorldSpace Position</param>
/// <param name="map">Mapbox Abstract Map Instance</param>
/// <returns>Worldscale Unit conversion</returns>
public static float GetOneMapMeterInUnityMeters(Vector3 targetPlayerPos,AbstractMap map)
{
// hackish way of doing the conversion, since there is no obvious way of doing it in the API
// taking a position X meters away, converting to map coords, and then back into unity world coords.
var playerPosGps = map.WorldToGeoPosition(targetPlayerPos);
var playerPosInMeters = Conversions.LatLonToMeters(playerPosGps);
var playerPosInMeters1MeterAway = playerPosInMeters + new Vector2d(1, 0);
var oneMeterAwayLatLon = Conversions.MetersToLatLon(playerPosInMeters1MeterAway);
var worldPosOneMeterAway = map.GeoToWorldPosition(oneMeterAwayLatLon);
var oneMapMeterInUnityMeters = (worldPosOneMeterAway - targetPlayerPos).magnitude;
return oneMapMeterInUnityMeters;
}
@wei-kris did this solve your problem ?
@Markovicho Thank you. I got a number of 0.7664185. Does this mean that 1 meter is equal to 0.7664185 unity unit?


WorldScale : Map is rendered at actual scale, unity to mercator conversion factor is ignored. I originally thought that when I used this option, the ratio of unity world to real world was 1:1
@wei-kris if you need precision, I think best approach would be converting latlng values and calculating great circle distance formulas directly. Unity visualization will always be off, sometimes quite a lot due to the effect of latitude not being calculated properly.