52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
namespace XCEngine
|
|
{
|
|
public struct RaycastHit
|
|
{
|
|
private ulong m_gameObjectUUID;
|
|
private Vector3 m_point;
|
|
private Vector3 m_normal;
|
|
private float m_distance;
|
|
private bool m_isTrigger;
|
|
|
|
internal RaycastHit(
|
|
ulong gameObjectUUID,
|
|
Vector3 point,
|
|
Vector3 normal,
|
|
float distance,
|
|
bool isTrigger)
|
|
{
|
|
m_gameObjectUUID = gameObjectUUID;
|
|
m_point = point;
|
|
m_normal = normal;
|
|
m_distance = distance;
|
|
m_isTrigger = isTrigger;
|
|
}
|
|
|
|
public GameObject GameObject => m_gameObjectUUID != 0 ? new GameObject(m_gameObjectUUID) : null;
|
|
public GameObject gameObject => GameObject;
|
|
|
|
public Transform Transform
|
|
{
|
|
get
|
|
{
|
|
GameObject hitObject = GameObject;
|
|
return hitObject != null ? hitObject.Transform : null;
|
|
}
|
|
}
|
|
|
|
public Transform transform => Transform;
|
|
|
|
public Vector3 Point => m_point;
|
|
public Vector3 point => Point;
|
|
|
|
public Vector3 Normal => m_normal;
|
|
public Vector3 normal => Normal;
|
|
|
|
public float Distance => m_distance;
|
|
public float distance => Distance;
|
|
|
|
public bool IsTrigger => m_isTrigger;
|
|
public bool isTrigger => IsTrigger;
|
|
}
|
|
}
|