예제 #1
0
        public GridCellRayHit(Ray ray, float hitEnter, XZGridCell hitCell)
        {
            _ray      = ray;
            _hitEnter = hitEnter;

            _hitCell   = hitCell;
            _hitPoint  = ray.GetPoint(hitEnter);
            _hitNormal = _hitCell.ParentGrid.Plane.normal;
        }
예제 #2
0
        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);
        }
예제 #3
0
        private GridCellRayHit GetGridCellHit(XZGrid hitGrid, Ray ray, float t)
        {
            XZGridCell hitGridCell = hitGrid.GetCellFromWorldPoint(ray.GetPoint(t));

            return(new GridCellRayHit(ray, t, hitGridCell));
        }