Page 1 of 1

Building position/coverage

Posted: 27 Oct 2009, 22:43
by casperjeff
If I get an event say for example that a vehicle factory entered my line of site (or the line of site of a specific unit.....btw, there is no way to determine what unit actually 'spotted' another, is there?), I can get it's position and I can get it's x and z size from the unitdef.... but where is the position with relation to the x and z 'widths'? Is the position the upper left corner...and it extends X units right and z units down? Or is it (god forbid) centered on the position?

Re: Building position/coverage

Posted: 28 Oct 2009, 09:19
by initram
As I understand it the position is the center of a unit and the x-size and z-size are the width and height of the building in map coodinates (1/8 of the position coordinates) and that is only given that the facing is 0.

If the facing is different (ranges from 0-3), the x-size and z-size changes its meaning from width to height and from height to width. I think 0 and 2 it is normal and 1 and 3 it has the other meaning.

Re: Building position/coverage

Posted: 28 Oct 2009, 13:35
by casperjeff
seems to match up with what I am seeing...thanks.....

Re: Building position/coverage

Posted: 28 Oct 2009, 15:07
by SpliFF
casperjeff wrote:btw, there is no way to determine what unit actually 'spotted' another, is there?)
possibly not directly but the lua api provides a GetClosestEnemy(unit) function which you could simply pass the factory id to. Of course there's no guarentee that the closest unit is actually the one that spotted it (due to los distance differences) but you'd probably find that's good enough for most practical purposes.