Esempio n. 1
0
        /// <summary>
        /// Update grid cell and internal offset
        /// </summary>
        public void ForceSectorUpdate()
        {
            long  deltaSector;
            float nx = 0; float ny = 0; float nz = 0;
            long  lx = 0; long ly = 0; long lz = 0;

            deltaSector = (long)(sectorOffset.x / defaultSectorSize.x);
            nx          = sectorOffset.x - defaultSectorSize.x * deltaSector;
            lx          = sector.x + deltaSector;

            deltaSector = (long)(sectorOffset.y / defaultSectorSize.y);
            ny          = sectorOffset.y - defaultSectorSize.y * deltaSector;
            ly          = sector.y + deltaSector;

            deltaSector = (long)(sectorOffset.z / defaultSectorSize.z);
            nz          = sectorOffset.z - defaultSectorSize.z * deltaSector;
            lz          = sector.z + deltaSector;

            sectorOffset = new Vector3(nx, ny, nz);
            sector       = new Long3(lx, ly, lz);
        }
Esempio n. 2
0
 public WorldPosition(WorldPosition other) : this()
 {
     this.sector       = new Long3(other.sector);
     this.sectorOffset = new Vector3(other.sectorOffset.x, other.sectorOffset.y, other.sectorOffset.z);
 }
Esempio n. 3
0
 public WorldPosition(Long3 sector) : this()
 {
     this.sector = sector;
 }
Esempio n. 4
0
 public WorldPosition(Vector3 pos, Long3 sector) : this()
 {
     this.sectorOffset = pos;
     this.sector       = sector;
     ForceSectorUpdate();
 }
Esempio n. 5
0
 public WorldPosition()
 {
     this.sectorOffset = new Vector3(0f, 0f, 0f);
     this.sector       = new Long3(0, 0, 0);
 }