Weapon accuracy, tracking, wobble, etc
Posted: 06 May 2016, 23:05
Hi!
I'm writting a gadget, crucial helper function of which should return a probability if particular weapon (of particular unit) can hit a target.
Up to the certain point I have progressed ok and took into account, besides the obvious things like target's speed, projectile speed and distance, weapon's accuracy, sprayAngle, and radar wobble (allyteamErrorSize). For the sake of future reuse I'm putting code snippet that covers those variables:
However, the point I'm kind of stuck with missile projectiles. Specifically w.r.t. properties such as wobble, dance and turnRate. The meaning of each parameter is known as well as what changes it does to the projectile in flight, however I found it diffucult to find some kind of algorithm or formula to estimate the shape and size of possible area of damage (if wobble overpowers tracking) or if a target given it's speed can dodge the missile (if tracking dominates).
Can someone help?
I'm writting a gadget, crucial helper function of which should return a probability if particular weapon (of particular unit) can hit a target.
Up to the certain point I have progressed ok and took into account, besides the obvious things like target's speed, projectile speed and distance, weapon's accuracy, sprayAngle, and radar wobble (allyteamErrorSize). For the sake of future reuse I'm putting code snippet that covers those variables:
Code: Select all
--unitWD -weapondef
--factors that affect accuracy in negative way
local scatter = unitWD.accuracy or 0 + unitWD.sprayAngle or 0
local allyteamErrorSize = 0
if not (targetInLoS or targetIdentifiedStatic) then
allyteamErrorSize = Spring.GetRadarErrorParams(allyTeam) --apply radar wobble
end
distance3D -- is 3D distance between unit and target, may well be distance in 2D
local scatterRadius = scatter * distance3D + allyteamErrorSize
-- targetRadius is target's XZ hit volume
local hitScatterProbability = 1 - math.max( (scatterRadius-targetRadius)/scatterRadius , 0 ) --prevent values < 0
Can someone help?