コード例 #1
0
 /// <summary>
 /// Finds the main camera in the root of the transform or any of its children.
 /// </summary>
 /// <param name="transform">
 /// The child of the transform that contains the camera tagged <c>MainCamera</c>.
 /// </param>
 /// <returns>
 /// The root camera or null if a camera could not be found.
 /// </returns>
 public static Camera FindRootCamera(Transform transform)
 {
     return(CameraUtils.FindRootCamera(transform, "MainCamera"));
 }
コード例 #2
0
 /// <summary>
 /// Converts the screen point to a world point using the transform's root
 /// camera. The distance from the camera to the world point will be the
 /// same as the distance from the camera to the transform along the z axis.
 /// </summary>
 public static Vector3 ScreenToWorldPoint(Vector2 point, Transform transform)
 {
     return(CameraUtils.ScreenToWorldPoint(point, transform, CameraUtils.FindRootCamera(transform)));
 }
コード例 #3
0
 /// <summary>
 /// Converts the touch to a world point using the transform's root camera.
 /// The distance from the camera to the world point will be the same as the
 /// distance from the camera to the transform along the z axis.
 /// </summary>
 public static Vector3 TouchToWorldPoint(Touch touch, Transform transform)
 {
     return(CameraUtils.TouchToWorldPoint(touch, transform, CameraUtils.FindRootCamera(transform)));
 }