Building position/coverage
Moderators: hoijui, Moderators
-
- Posts: 51
- Joined: 14 Aug 2008, 21:54
Building position/coverage
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
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.
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.
-
- Posts: 51
- Joined: 14 Aug 2008, 21:54
Re: Building position/coverage
seems to match up with what I am seeing...thanks.....
Re: Building position/coverage
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.casperjeff wrote:btw, there is no way to determine what unit actually 'spotted' another, is there?)