I'm use demo from this repo.
If you set the following coordinates for objects, the value is not calculated correctly.
Start: x: 27.5 z: -33.5
Sphere: x: -2 z: 1.5
I partially studied the algorithm and came to the conclusion that the problem is here:
if (positionX % half! = 0 || positionX % 1 == 0)
How best to solve this problem? Thanks)