# OpenRA/OpenRA

Merged
merged 4 commits into from Mar 9, 2018

## Conversation

Projects
None yet
4 participants
Member

### abcdefg30 commented Feb 22, 2018

 #13484 revived.
Contributor

### Unit158 commented Feb 22, 2018 • edited

 Looks sane, and it works. I'm not fond of some of the variable naming, but I couldn't think of anything better so 👍 Tried some edge cases, and it looks like there's some weirdness going on with hit detection. All I did was increase all of the polygon values on the medium tank by an order of magnitude. If this isn't a problem with the code here, then my +1 still stands :) Yep. Looks like this is part of the impact code (scanning for the actor's center if it lands outside of the impact shape or something?), not the polygon code.

### reaperrr reviewed Feb 23, 2018

 squares[i] = (Points[i] - Points[i - 1]).LengthSquared; } static int DistanceSquaredFromLineSegment(int2 c, int2 a, int2 b, int ab2)

#### reaperrr Feb 23, 2018

Contributor

There must definitely be something wrong either in this...

### reaperrr reviewed Feb 23, 2018

 return (ac - ap).LengthSquared; } public WDist DistanceFromEdge(WVec v)

#### reaperrr Feb 23, 2018 • edited

Contributor

...or this.

Shots that land rather close to an edge, but whose AoE does not cover any of the polygons, deal zero damage.

Contributor

### Unit158 commented Mar 2, 2018

 I took a look at this a while back. I think there's at least an absolute value missing somewhere.

### Unit158 reviewed Mar 2, 2018

 // c is closest to its unknown orthogonal projection (p) onto the line spanned by b with a as the origin var ab = b - a; var ap2 = ac.X * ab.X + ac.Y * ab.Y; var ap = new int2(ab.X * ap2 / ab2, ab.Y * ap2 / ab2);

#### Unit158 Mar 2, 2018

Contributor

ab.X * ap^2 and ab.Y * ap^2 will overflow for larger hitboxes.

Author Member

Fixed, thanks.

### atlimit8 and others added some commits Jun 9, 2017

``` Added Polygon IHitShape ```
``` 592f3c6 ```
``` Fix int2 arrays not being parsed ```
``` 6539914 ```
``` Throw a proper error when parsing an invalid int2 ```
``` 6502589 ```
``` Replace 'target point' by 'center' in all descriptions ```
``` f1ab284 ```

Contributor

### reaperrr commented Mar 9, 2018

 👍 after testcase has been removed.

Member Author

### abcdefg30 commented Mar 9, 2018

 Removed it.

### reaperrr merged commit `b012fa6` into OpenRA:bleed Mar 9, 2018 2 checks passed

#### 2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Contributor

Closed