Beispiel #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;
        }
Beispiel #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);
        }
Beispiel #3
0
        private GridCellRayHit GetGridCellHit(XZGrid hitGrid, Ray ray, float t)
        {
            XZGridCell hitGridCell = hitGrid.GetCellFromWorldPoint(ray.GetPoint(t));

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