Deducing Elevation - sh4rkman/SquadCalc GitHub Wiki

⬅️ Previous: Deducing Altitude    •    Next: Deducing Spread ➡️



Now that we know the distance, and the height difference between weapon and target, we can jump into Projectile Motion calculations. Lets focus on the "Angle θ required to hit a (x, y) coordinate".

Formula

From Wikipedia, to hit a target at range x and altitude y when fired from (0,0) and with initial speed v the required angle(s) of launch θ are:

$θ = \arctan{( \dfrac{v^2 + \sqrt{ v^4 - g \times (g \times x² + 2 \times y \times v²) }}{g \times x} )} $

where :

  • g is the ingame gravity (9.78)
  • v is the weapon velocity, which we can find in the SDK
  • x the distances between weapon and target (previously discussed here)
  • y the height difference between weapon and target (previously discussed here)

Application

For our previous example, we found that weapon and target are 632.46m from each others, let's simplify and say there is no height difference :

  • x = 632.46
  • y = 0

Using the gravity (9.78) and velocity (110m/s) found in the SDK for regular mortars we now have :

$θ = \arctan{( \dfrac{110^2 + \sqrt{ 110^4 - 9.78 \times (9.78 \times 632.46^2 + 2 \times 0 \times 110^2)}}{9.78 \times 632.46} )} $

$θ = \arctan{( \dfrac{110^2 + \sqrt{ 110^4 - 9.78 \times (9.78 \times 632.46^2})}{9.78 \times 632.46} )} $

$θ ≃ 1.305 rad ≃ 1327 mil ≃ 74.8° $

That's our weapon elevation !


High / Low angles

For every weapon and target solution, there is two firing solutions available :

  1. a "high" angle, between 45° and 90°
  2. a "low" angle, between 0° and 45°

Some weapons in Squad are locked ingame into a high angle, regular mortars for example can only shoot from 45° to 88.8°. But most vehicles can also be tilted or can already by default shoot at low angles.

image
same initial velocity, two firing solutions.

The wikipedia article isn't clear about it but the formula it gives only results in high angles, when in fact there is two formulas :

$θ_{high} = \arctan{( \dfrac{v^2 + \sqrt{ v^4 - g \times (g \times x² + 2 \times y \times v²) }}{g \times x} )} ≃ 1.305 rad ≃ 1327 mil ≃ 74.8° $

and

$θ_{low} = \arctan{( \dfrac{v^2 - \sqrt{ v^4 - g \times (g \times x² + 2 \times y \times v²) }}{g \times x} )} ≃ 0.2683 rad ≃ 273 mil ≃ 15.3° $

We now have the ability to calculate firing solution for high angles (regular mortars, m121) but also for weapons with more direct fire (UB32, GRAD). We can now even choose what angle we want to shoot a weapon !



⬅️ Previous: Deducing Altitude    •    Next: Deducing Spread ➡️

⚠️ **GitHub.com Fallback** ⚠️