View topic - Building position/coverage



All times are UTC + 1 hour


Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 27 Oct 2009, 22:43 

Joined: 14 Aug 2008, 20:54
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?


Top
 Offline Profile  
 
PostPosted: 28 Oct 2009, 09:19 
AI Coder

Joined: 07 Sep 2009, 13:28
Location: Aalborg, Denmark
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.


Top
 Offline Profile  
 
PostPosted: 28 Oct 2009, 13:35 

Joined: 14 Aug 2008, 20:54
seems to match up with what I am seeing...thanks.....


Top
 Offline Profile  
 
PostPosted: 28 Oct 2009, 15:07 
User avatar

Joined: 28 Jul 2008, 05:51
Location: Australia
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.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.