First of all, Great packages , using extensively FoW and HudText.

Just noticed 2 issues with Tasharen Fog Of War.

1. In the FowSystem class in RevealUsingLOS() and RevealUsingCache() methods there is incositency in the dimensioning of the variables, in the case of

* (dist < maxRange)*Vector2 v

= new Vector2

(xd, yd

);v.Normalize();

v *= r.inner;

int sx= cx+ Mathf.RoundToInt(v.x);

int sy= cy+ Mathf.RoundToInt(v.y);

all the variables are declared in "texture" space (i.e. multiplied with worldtoTex), except the r.inner value which is declared in "real world" value. So , the fix is to multiply them by worldToTex also

int sx= cx+ Mathf.RoundToInt(v.x * worldToTex);

int sy= cy+ Mathf.RoundToInt(v.y * worldToTex);

2. The second one is more of a special case handling. For instance I'm having a huge world (size), with a relatively small texture size for the fog texture. So in a specific scenario it is possible for the revealer cache calculations to have errors in the approximation. Namely the RevealIntoCache method works with

Test Scenario :

Fow System :

position in real world {{7500,120,7300}}

World size : 178000

Texturesize : 1024

Position of revealer in "FoW" world : {(2615.0, 59.0, 6079.0)} , radius inner: 1200 , outer :1250

worldToTex = 0,05752809

int size = Mathf.RoundToInt(xmax - xmin);

r

.cachedBuffer = new bool[size

* size

];r.cachedSize = size;

the calculation of xmin , xmax , ymin, ymax suffers a loss in precision and the cache buffer is smaller.

(IE ,

*Mathf.RoundToInt(xmax - xmin) == 143* while

*Mathf.RoundToInt(ymax - ymin) == 144*)

, so the line

r.cachedBuffer[(x - xmin) + (y - ymin) * size] = true;

fails.

As a safety precaution (temp fix) i formed a buffer from the largest of the min-max range

int size = Mathf.Max(Mathf.RoundToInt(xmax - xmin), Mathf.RoundToInt(ymax - ymin));