Unity中结构体RaycaseResult详解

发表于2018-05-11
评论0 1.8k浏览
RaycaseResult存在于EventSystem事件系统中,下面就和大家介绍下结构体RaycaseResult。

代码如下:
using System;  
namespace UnityEngine.EventSystems  
{  
public struct RaycastResult  
{  
//  
// Fields  
//  
public BaseRaycaster module; // BaseInputModule that raised the hit.  
public float distance; // Distance to the hit.  
public float index; // Hit index.  
public int depth; //The relative depth of the element.  
public int sortingLayer; // The SortingLayer of the hit object. 官方解释的这两个一样,完全不明白  
public int sortingOrder; // The SortingOrder for the hit object.  
public Vector3 worldPosition; // The world position of the where the raycast has hit.  
public Vector3 worldNormal; // The normal at the hit location of the raycast.  
public Vector2 screenPosition; // The screen position from which the raycast was generated.  
//  
// Properties  
//  
public GameObject gameObject { // The GameObject that was hit by the raycast.  
get;  
set;  
}  
public bool isValid { // Is there an associated module and a hit GameObject.  
get;  
}  
//  
// Methods  
//  
public void Clear ();  
public override string ToString ();  
}  
}  

如社区发表内容存在侵权行为,您可以点击这里查看侵权投诉指引

0个评论