Exemple #1
0
	Vector3 WorldToMinimapUiPosition(Vector3 pos)
	{
		var cameraPosition = new Vector3(minimapCamera.transform.position.x, 0, minimapCamera.transform.position.z);
		var iconPosition = new Vector3(pos.x, 0, pos.z);
		var delta = iconPosition - cameraPosition;

		delta.y = delta.z;
		delta.z = 0.0f;

		var rotatedDelta = minimapRotation.TransformDirection(delta);
		var deltaFactor = CameraUtility.CalculateFactor(minimapCamera) * worldToTexelFactor;
		rotatedDelta *= deltaFactor;

		var radius = rotatedDelta.magnitude;
		if (radius > minimapBorderRadius)
		{
			rotatedDelta.Normalize();
			rotatedDelta *= minimapBorderRadius;
		}
		return rotatedDelta;
	}