Jump to content
Sign in to follow this  
HëllRÆZØR

A LoS formula

Recommended Posts

Sometimes, it's hard to tell wether a certain object or figure blocks line of sight (LoS). To solve this problem, you can use a thread, diagrams, or the following simple mathematical approach:

  • Draw a line between attacker and target (both center of the space), and calculate its slope
  • Draw a line between attacker (center) and the corner of the space that might block LoS, and calculate its slope
  • Compare the slopes from both lines to determine where the corner lies compared to the attacker-target line.

 The slope is just the y-difference divided by the x-difference. Since we're only interested in how steep the slope is, we can ignore negative distances. Here are a few examples:

(A = attacker, T = target, B = blocking obstacle)

 

 (1)

XXXT

AXBB

 

The y-difference between A and T is 1, the x-difference is 3, so the slope is 1/3. The y-difference between A and the upper left corner from the left B is 0.5 (a half space - we start at the center of A), the x-difference is 1.5, which yields 0.5/1.5 = 1/3. Since both slopes are identical, the upper left corner from the blocking obstacle lies exactly on the line between A and T, so A sees T.

 

 (2a)

XXT

ABB

 

Slope from A-T-line is 1/2, slope from A-C-line is 0.5/0.5 = 1 (C = upper left corner). Since 1 is steeper than 1/2, C lies above the A-T-line, and A doesn't see B.

 

(2b)

AX

BX

BT

 

... the same situation as (2a), just from another angle of view. Slope A-T is 2 (we don't care about negative slope), slope A-C is 1 (C = upper right corner). Here, A-T is steeper than A-C, but since it leads downwards, C lies again above A-T.

  

You may like this approach, or you don't, and I understand people who prefer other ways. I prefer this one because it's exact, universal, and you don't need any utilities, but that's just personal taste. gui%C3%B1o.gif

Share this post


Link to post
Share on other sites

Knuckles Eki said:

 

Pretty good, though I don't think anyone would want to calculate all that just to see if the marine can JUST see the Hell Knight to give it some peppering.

 

Well, I would do so. ^^

It's not much of an effort to me - I just check the distance to the target, build the fraction, do the same with the distance to the corner of the space that may block LoS, and compare the fractions. If it's not immediately obvious which fraction is larger, I simply extend them.

Of course I wouldn't do this before each attack, only when we disagree wether a figure has LoS to the target.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...