2019-12-08 14:12 CET

View Issue Details
IDProjectCategoryView StatusLast Update
0005680Spring engineGeneralpublic2017-07-31 17:17
Reportersprung
Assigned To
PrioritylowSeverityminorReproducibilityhave not tried
StatusnewResolutionopen
Product Version103.0 +git
Target VersionFixed in Version
Summary0005680: Projectile leading might be wrong
Descriptionhttps://github.com/spring/spring/blob/develop/rts/Sim/Weapons/Weapon.cpp#L1210

It takes the projectile ETA to *current* target position (L 1212) and then aims at the spot that the target will be after this time (L 1213). That other spot might not have the same ETA.

See attached picture.

|AC| = 100
|BC| = 200
|AB| = 100*sqrt(3) = 173

Unit A wants to shoot at B with a 10 speed weapon.
B is moving towards C at speed 5.

ETA to current pos: 173 distance / 10 speed = 17 time.
After 17 time, B will be at point D, so unit A shoots at point D.
However |AD| = 108 so the weapon will be there after 0000013:0000011 time, which is 6 time before B arrives there.

The correct place to shoot would be about 60 distance from B which is 120 distance from A, so that both the projectile and the unit arrive after 12 time.

In general the equation only works when the target is moving in a circle around C (so that distance to current pos == distance to leading target pos).
Additional InformationThis sounds somewhat hard in that there are multiple subproblems to consider:
* what if the unit is moving away faster than the projectile? That makes the lead pos not exist. Currently there always exists a lead pos, however inaccurate.
* performance. Doing this correctly requires solving quadratic equations, sounds way slower than current.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

 Relationships
 Relationships

 Notes ~0018144 sprung (reporter) 2017-07-31 17:03 That ticket link was "after approx. 11 time" and the last sentence of descriptions should read "circling around A". ~0018145 Kloot (developer) 2017-07-31 17:17 Known. The lead inaccuracy becomes problematic only with projectiles that move slowly relative to units, most of the time it is hidden by unit collision volumes not being points. Major rabbit holes should not be entered right before a release.
 Notes

 Date Modified Username Field Issue History 2017-07-31 16:59 sprung New Issue 2017-07-31 16:59 sprung File Added: leading.png 2017-07-31 17:03 sprung Note Added: 0018144 2017-07-31 17:17 Kloot Note Added: 0018145
 Issue History