public GridCellRayHit(Ray ray, float hitEnter, XZGridCell hitCell) { _ray = ray; _hitEnter = hitEnter; _hitCell = hitCell; _hitPoint = ray.GetPoint(hitEnter); _hitNormal = _hitCell.ParentGrid.Plane.normal; }
public List <Vector3> GetCellCornerPoints(XZGridCell gridCell) { float startX = gridCell.CellIndexX * _cellSizeX; float startZ = gridCell.CellIndexZ * _cellSizeX; var cellCornerPoints = new List <Vector3>(); cellCornerPoints.Add(new Vector3(startX, 0.0f, startZ)); cellCornerPoints.Add(new Vector3(startX + _cellSizeX, 0.0f, startZ)); cellCornerPoints.Add(new Vector3(startX + _cellSizeX, 0.0f, startZ + _cellSizeZ)); cellCornerPoints.Add(new Vector3(startX, 0.0f, startZ + _cellSizeZ)); return(cellCornerPoints); }
private GridCellRayHit GetGridCellHit(XZGrid hitGrid, Ray ray, float t) { XZGridCell hitGridCell = hitGrid.GetCellFromWorldPoint(ray.GetPoint(t)); return(new GridCellRayHit(ray, t, hitGridCell)); }