zoukankan      html  css  js  c++  java
  • RectTransformUtility.ScreenPointToWorldPointInRectangle使用说明

    首先,看Unity Scripting API上的介绍:

    public static bool ScreenPointToWorldPointInRectangle(RectTransform rect, Vector2 screenPoint, Camera cam, out Vector3 worldPoint);
    描述:
    将屏幕空间上的点转换为位于给定RectTransform平面上的世界空间中的位置。cam参数应该是与屏幕点相关的相机。对于Canvas设置为“Screen Space - Overlay mode”模式的情况,cam参数应该为null。

    示例:Vector2 position;

               RectTransformUtility.ScreenPointToWorldPointInRectangle(GameObject.Find("Canvas").transform as RectTransform,Input.GetmousePosition,null,out positoin) // 将当前所在像素坐标的鼠标位置转换为Canvas物体所在平面上的世界空间中的位置,将位置信息返回给position

  • 相关阅读:
    Apache 基础
    Oracle
    DevOps
    Ansible
    Iptables 和Firewall 防火墙
    防火墙
    Linux
    Intellij IDEA 快捷键大全
    Java8,9 新特性
    Jmeter
  • 原文地址:https://www.cnblogs.com/Dearmyh/p/9351706.html
Copyright © 2011-2022 走看看