toddw123 / RotMG_Clientless

Compatible with version X16.0.0
MIT License
11 stars 4 forks source link

helper functions for WorldPosData #13

Closed ebf34e12952930cf closed 7 years ago

toddw123 commented 7 years ago

Why are you returning atan2 as a double? Or wait, why are you returning all of the helper functions in WorldPosData as doubles? I dont follow why that would be better then returning it as a float, which all of the math functions used do support.

toddw123 commented 7 years ago

It also doesnt make too much sense to break the distanceTo function into 2 different functions, unless you see there being a need to call them separately? And i dont follow the reason for the change in this line: if (loc.sqDistanceTo(target) > step * step) From the definition of the sqDistanceTo function, i cant see step * step ever being greater then sqDistanceTo (especially since step is like .6-.8 for new players). Why not just change it to: if (loc.distanceTo(target) > step) ?

ebf34e12952930cf commented 7 years ago

the doubles are just because prod does that, but i can change it to floats if that's preferred here. the distanceTo is just if you're not using squared values. i changed it to squared values because if i remember correctly, its faster to not use sqrt and instead do squared values, but i may be wrong.

toddw123 commented 7 years ago

Eh whatever works for the sqrt thing i guess. But yes i would prefer to keep the values as floats instead of converting it over to a double and then back to a float to send.