Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int i = 0; i < loc.Length; i++) //Pass thru whole localizations in DB
- {
- //POI position relative to user pos
- float y = (float)(loc[i].x - lat);
- float x = (float)(loc[i].y - lng);
- Vector2 pos = new Vector2(x, y);
- double dist = DistanceAlgorithm.DistanceBetweenPlaces(lng, lat, loc[i].y, loc[i].x); //Distance from user to point in meters
- Debug.Log(dist);
- if (dist < m_POIMinDistance) //Stop drawing closer objects i.e. 10 meters
- continue;
- Vector2 fromVector = Vector2.up; // North direction (0, 1)
- Vector2 toVector = pos;
- float ang = Vector2.Angle(fromVector, toVector); //Get angle between north and POI based
- Vector3 cross = Vector3.Cross(fromVector, toVector); //Cross production to maintain proper angle
- if (cross.z > 0)
- ang = 360 - ang; //Got angle
- Debug.Log(ang);
- //Force point on the circle
- x = m_POIScale * m_POIDistanceFactor * Mathf.Cos(ang);
- y = m_POIScale * m_POIDistanceFactor * Mathf.Sin(ang);
- pos = new Vector2(x, y); //Apply scaled positions to vector
- //Create POI prefab
Advertisement
Add Comment
Please, Sign In to add comment