Soldat Fans > Developers Corner

Perps? - What are poly's perps in Soldat maps and what are they good for?

(1/1)

laB:
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

Furai:
I'll bug Fryer about it. He'll know answer for sure.

Fryer:
"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: ---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

--- End code ---

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: ---Perp.X = Perp.X*B
Perp.Y = Perp.Y*B

--- End code ---

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

laB:
Now I understand :)
Thanks, Fryer.

Navigation

[0] Message Index

Go to full version