Well, once you have the line, you can access the line'sVaecrius wrote:someone else will have to reply with how to get the angle (which I'd like to know as well).

*delta*vector and get the vector perpendicular to it:

Code: Select all

```
Vector2 perpVec = (-line.delta.y, line.delta.x).unit();
```

*r = d - 2(d dot n)n*(where n must be normalised; this is the point of the .unit() call) to generate the reflected vector:

Code: Select all

```
Vector2 reflected = vel.xy - 2 * (vel.xy dot perpVec) * perpVec;
```

*reflected*a Vector3, removing all calls to

*.xy*in the formula, and constructing a 3d

*perpVec*(where Z will always be 0 since a linedef cannot be sloped)). Then, if you want the angle of reflection:

Code: Select all

```
double rAngle = atan2(reflected.y, reflected.x);
```