Is this how you calculate the if a spell is in range?
function IsInRange ( targetUnit, sourceUnit, range ) local r = range if range == nil then r = math.huge end return targetUnit.pos:DistanceTo ( sourceUnit.pos ) < r end
I'm not sure if pos is the point where the character's feet stand or if it's the center of gravity of it's collision box, whatever it is, some adjusments got to be made because a skill is in range not only if it can hit another unit's feet or their center of gravity, it is in range when it can hit any point of the target's hit box.
What I need to know is:
- is pos the location where the unit stands? or is it the barycenter of its hit box?
- how do I get a unit's hit box?
- how do I get a skill's "area of effect" (in case of, for example, brand's Q, it would be the missile's hit box, in case of brand's W it would be the radius of the circle, in case of brand's E it would be 0, because it is a punctual skill)