示例#1
0
 /// <summary>
 /// Converts the touch to a camera point, where the z coordinate is the
 /// distance from the camera to the transform on the z axis.
 /// </summary>
 public static Vector3 TouchToCameraPoint(Touch touch, Transform transform, Camera camera)
 {
     return(CameraUtils.ScreenToCameraPoint(touch.Position, transform, camera));
 }
示例#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>
 /// 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"));
 }
示例#4
0
 /// <summary>
 /// Converts the screen point to a world point. 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, Camera camera)
 {
     return(camera.ScreenToWorldPoint(CameraUtils.ScreenToCameraPoint(point, transform, camera)));
 }
示例#5
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)));
 }