GridCellRayHit.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #if UNITY_EDITOR
  2. using UnityEngine;
  3. namespace O3DWB
  4. {
  5. public class GridCellRayHit
  6. {
  7. #region Private Variables
  8. private Ray _ray;
  9. private float _hitEnter;
  10. private XZGridCell _hitCell;
  11. private Vector3 _hitPoint;
  12. private Vector3 _hitNormal;
  13. #endregion
  14. #region Public Properties
  15. public Ray Ray { get { return _ray; } }
  16. public float HitEnter { get { return _hitEnter; } }
  17. public XZGridCell HitCell { get { return _hitCell; } }
  18. public Vector3 HitPoint { get { return _hitPoint; } }
  19. public Vector3 HitNormal { get { return _hitNormal; } }
  20. #endregion
  21. #region Constructors
  22. public GridCellRayHit(Ray ray, float hitEnter, XZGridCell hitCell)
  23. {
  24. _ray = ray;
  25. _hitEnter = hitEnter;
  26. _hitCell = hitCell;
  27. _hitPoint = ray.GetPoint(hitEnter);
  28. _hitNormal = _hitCell.ParentGrid.TransformMatrix.GetNormalizedUpAxis();
  29. }
  30. #endregion
  31. }
  32. }
  33. #endif