Official Soldat Forums

Soldat Fans => Developers Corner => Topic started by: laB on July 08, 2011, 02:40:36 pm

Title: Perps? - What are poly's perps in Soldat maps and what are they good for?
Post by: laB on July 08, 2011, 02:40:36 pm
Hello, can someone explain me, what (and what for) are poly's perps in Soldat map, and how to calculate them? Very please :)

EDIT: fixed bad topic subject
Title: Re: Perps? - What are poly's perps in Soldat maps and what are they good for?
Post by: Furai on July 08, 2011, 03:35:02 pm
I'll bug Fryer about it. He'll know answer for sure.
Title: Re: Perps? - What are poly's perps in Soldat maps and what are they good for?
Post by: Fryer on July 08, 2011, 04:57:25 pm
"Perp" is short for "perpendicular", which is the direction in which the side of the polygon is facing. Since polygons in Soldat have 3 sides, they also have 3 perpendiculars.

To calculate the perpendicular (Perp) of a polygon with vertices ordered in a clockwise order between vertex V_1 and V_2, use this code:
Code: [Select]
Diff.X = V_2.Y - V_1.Y
Diff.Y = V_2.X - V_1.X
Length = sqrt(Diff.X^2 + Diff.Y^2)
Perp.X = Diff.Y/Length
Perp.Y = Diff.X/Length

On bouncy polygons the length of the perpendicular indicates the polygon's bounce power (1 = no bounce). Calculating the perpendiculars with a bounciness factor (B) can be done like this:
Code: [Select]
Perp.X = Perp.X*B
Perp.Y = Perp.Y*B

The reason this information is saved in the map format is probably speed, but the perpendiculars could be calculated when the map is loaded in Soldat instead, so I don't really know why MM decided to make it the map editors responsibility... :P
Title: Re: Perps? - What are poly's perps in Soldat maps and what are they good for?
Post by: laB on July 08, 2011, 05:55:12 pm
Now I understand :)
Thanks, Fryer.