Closed DingumBoingum closed 5 years ago
Thanks for the suggestion! I've be unsure how much to optimize the code vs make it clear how it works. In this case, I think I'd keep the full calculation so we have an actual distance (and not just a comparison). But a section on optimization and more advanced collision methods is brewing, so if you have other ideas please let me know!
There are plenty of places where distances are compared, and both are first calculated using sqrt calculations, which are notoriously slow. Comparing the distances before the square root calculation will still yield accurate results when comparing length.