Post reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
Name:
Email:
Subject:
Message icon:

shortcuts: hit alt+s to submit/post or alt+p to preview


Topic Summary

Posted by: yan
« on: March 24, 2019, 09:52:34 AM »

Excellent! Thanks!
Posted by: Kronnect
« on: March 21, 2019, 11:38:51 PM »

Hi,
Each cell object has a territoryIndex field:

Code
Cell cell = tgs.cells[cellIndex];
int territoryIndex = cell.territoryIndex;

Or even simpler:

Code
int territoryIndex = tgs.CellGetTerritoryIndex(cellIndex);

Regards


Posted by: yan
« on: March 21, 2019, 07:03:43 PM »

how do I access the territory associated with a cell in 3D space in script? I tried doing:

Code
cellCenter = tgs.CellGetPosition(cellIndex);
Vector3 cellCenterInLocalSpaceOfTerrain = terrain.transform.InverseTransformPoint(cellCenter);
Vector2 cellCenterV2 = new Vector2(cellCenterInLocalSpaceOfTerrain.x, cellCenterInLocalSpaceOfTerrain.z);
tgs.TerritoryGetAtPosition(cellCenterV2)
...but figured tgs.TerritoryGetAtPosition() is only meant for 2D maps, since it was returning empty (not null). Is there something similar for 3D space or another way to get the territory that is associated with a cell or vice versa?