unity 坐标之间的转换

 public static Bounds CalculateRelativeRectTransformBounds(Transform root, Transform child);
        public static Bounds CalculateRelativeRectTransformBounds(Transform trans);
        //
        // 摘要:
        //     Flips the horizontal and vertical axes of the RectTransform size and alignment,
        //     and optionally its children as well.
        //
        // 参数:
        //   rect:
        //     The RectTransform to flip.
        //
        //   keepPositioning:
        //     Flips around the pivot if true. Flips within the parent rect if false.
        //
        //   recursive:
        //     Flip the children as well?
        public static void FlipLayoutAxes(RectTransform rect, bool keepPositioning, bool recursive);
        //
        // 摘要:
        //     Flips the alignment of the RectTransform along the horizontal or vertical axis,
        //     and optionally its children as well.
        //
        // 参数:
        //   rect:
        //     The RectTransform to flip.
        //
        //   keepPositioning:
        //     Flips around the pivot if true. Flips within the parent rect if false.
        //
        //   recursive:
        //     Flip the children as well?
        //
        //   axis:
        //     The axis to flip along. 0 is horizontal and 1 is vertical.
        public static void FlipLayoutOnAxis(RectTransform rect, int axis, bool keepPositioning, bool recursive);
        //
        // 摘要:
        //     Convert a given point in screen space into a pixel correct point.
        //
        // 参数:
        //   point:
        //
        //   elementTransform:
        //
        //   canvas:
        //
        // 返回结果:
        //     Pixel adjusted point.
        public static Vector2 PixelAdjustPoint(Vector2 point, Transform elementTransform, Canvas canvas);
        //
        // 摘要:
        //     Given a rect transform, return the corner points in pixel accurate coordinates.
        //
        // 参数:
        //   rectTransform:
        //
        //   canvas:
        //
        // 返回结果:
        //     Pixel adjusted rect.
        public static Rect PixelAdjustRect(RectTransform rectTransform, Canvas canvas);
        public static bool RectangleContainsScreenPoint(RectTransform rect, Vector2 screenPoint);
        //
        // 摘要:
        //     Does the RectTransform contain the screen point as seen from the given camera?
        //
        // 参数:
        //   rect:
        //     The RectTransform to test with.
        //
        //   screenPoint:
        //     The screen point to test.
        //
        //   cam:
        //     The camera from which the test is performed from. (Optional)
        //
        // 返回结果:
        //     True if the point is inside the rectangle.
        public static bool RectangleContainsScreenPoint(RectTransform rect, Vector2 screenPoint, Camera cam);
        public static bool RectangleContainsScreenPoint(RectTransform rect, Vector2 screenPoint, Camera cam, Vector4 offset);
// 把屏幕坐标 转成 局部坐标
        public static bool ScreenPointToLocalPointInRectangle(RectTransform rect, Vector2 screenPoint, Camera cam, out Vector2 localPoint);
        public static Ray ScreenPointToRay(Camera cam, Vector2 screenPos);
        public static bool ScreenPointToWorldPointInRectangle(RectTransform rect, Vector2 screenPoint, Camera cam, out Vector3 worldPoint);
        public static Vector2 WorldToScreenPoint(Camera cam, Vector3 worldPoint);

rect:要转换的坐标所在的平面

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值