HomeWildfire Games

Remove branch from InParabolicRange

Description

Remove branch from InParabolicRange

Event Timeline

Silier added a comment.Nov 7 2020, 1:51 PM

Just proof that inParabolicRange computation here and in UnitAi is the same

h = target_y - (my_y + el) = target_y - my_y - el

(distance to target vs parabolic range)
d2 < c2
d2 < (c2 - y) * c
d2 < (c/2 - y) * c
(x + z)/2 < c*c/2 - y*c
x + z < c*c - 2*y*c

c = range
y = h

x + z < range*range - 2*h*range

UnitAI
h = my_y - target_y + el ( = -h from cpp)
pr * pr = range*range + 2 * range * h