DarkRewar / BaseTool

A big library of basic tools that you might need in your Unity projects.
MIT License
41 stars 6 forks source link

Add an `Approximately` method with larger comparison #86

Closed DarkRewar closed 5 months ago

DarkRewar commented 5 months ago

Currently, the Mathf.Approximately() does not work with value that aren't the "same".

For example, if the velocity of a rigidbody is near to 0, but not quite 0 (like 1E-24), the Mathf.Approximately(velocity.magnitude, 0) returns false.

This issue needs to create an Approximately method under MathUtils that can handle a third parameter which is the maximum difference allowed in the comparison.