View Single Post
09-15-14, 12:56 AM   #21
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Gello View Post
UnitDistanceSquared is, as it says, the distance from you to the unit, squared. If your friendly target is 50 yards away, UnitDistanceSquared("target") returns 2500. I've not done any debugprofilestop testing on it to tell if it's faster than (x2-x1)^2 + (y2-y1)^2, but it's very likely.
I wonder why they're not doing the final step of that equation to give us 50 instead of 2500? Is there any situation where you'd actually want the squared distance, and wouldn't just be immedately doing (value ^ 0.5) in your code?
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.