How to match position with Mini Map UI
Hello everyone, i'm trying to make a Mini using only UI, i have already done converting player's position into UI but i can't match the Mini Map background with the player's position, here is an image:
The Mini Map using only Image not camera Render the Big Green Ground with white blocks is an image i took by screenshot. here is my code:
public Camera miniMap_camera;
public Transform playerTransform;
public RectTransform playerMiniMap_Icon;
public RectTransform rectangleMiniMap;
private Vector2 playerScreenPoint;
private Vector2 miniMapIconPos;
void Update()
{
playerScreenPoint=miniMap_camera.WorldToScreenPoint(new Vector2(playerTransform.position.x,playerTransform.position.z));
RectTransformUtility.ScreenPointToLocalPointInRectangle(rectangleMiniMap,playerScreenPoint,miniMap_camera,out miniMapIconPos);
playerMiniMap_Icon.anchoredPosition=miniMapIconPos;
}
Comment