代码如下:

 1         static void DrawLine(UISprite spriteLine, Vector3 start, Vector3 end)
 2         {
 3             Vector3 center = (start + end) / 2f;
 4             Vector3 fromStart = end - start;
 5             Vector3 horVector = Vector3.right;
 6             Quaternion rot = Quaternion.FromToRotation(horVector, fromStart);
 7 
 8             spriteLine.transform.localPosition = center;
 9             spriteLine.transform.localRotation = rot;
10             spriteLine.width = Mathf.CeilToInt(fromStart.magnitude);
11         }

 转载请注明出处:https://www.cnblogs.com/jietian331/p/10653398.html

相关文章:

  • 2021-10-03
  • 2021-11-30
  • 2022-12-23
  • 2021-09-14
  • 2021-10-02
  • 2022-01-15
  • 2021-09-08
猜你喜欢
  • 2021-09-10
  • 2022-12-23
  • 2021-08-29
  • 2021-06-15
  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案