MathHelper
This static class provides pretty wide range of additional math functionality.
Available methods
This extension method creates string from given float number, rounded to certain count of digits after dot symbol.
Example:
This extension method returns shortened representation of given integer number. For example, 10.000 will be converted to "10k" and 1.500.000 will be converted to "1,5M".
Example:
This extension method adds unique elements from given items collection to given list. It adds all elements which are not yet presented in this list.
Example:
This extension method randomly shuffles given list.
Example:
It does the same as previous one.
This extension method sorts given list of Transforms by distance from given point, from closest one to farthest one.
This method could be useful if you need to find closest enemy or closest pickup to a certain game character.
This method returns distance between two transforms.
This method returns 2D distance between two given 3D transforms (in XZ plane, ignoring Y).
This method could be useful for getting distance between characters in top-down or strategy games, ignoring height of that characters.
This method returns distance between two positions.
This method returns 2D distance between two given 3D positions (in XZ plane, ignoring Y).
This method could be useful for getting distance between characters in top-down or strategy games, ignoring height of that characters.
This extension method returns random item from given list. If list is empty, it returns default value of given type.
Example:
This extension method returns random item from given list, except certain item. If it cannot find such item, it returns exceptedOne item instead.
Example:
Last updated