文档

Unity Engine

Unity Engine

ScreenPointToRay(Camera, Vector2)

Transforms a screen space position into a ray.
阅读时间1 分钟最后更新于 1 个月前

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.UIModule
public static Ray ScreenPointToRay(Camera cam, Vector2 screenPos)

Parameters

The camera from which the ray originates. (Optional)

screenPos

The screen point.

Returns

Type

Description

RayThe ray going from camera through the screen point if the camera is given, or from the screen point going forward if no camera is given.