This kept my mind really busy for at least 3 days, thinking about how to bake data and model the function to then obtain a result in real time that was valid not only for static objects but also for dynamic ones such as enemies or the main character of the video game I'm working on.
It was a really intense 3 days, waking up and going to sleep thinking about mathematical functions and failing to listen to my wife when she spoke to me for more than two minutes XD, but in the end I think I managed to get the solution I wanted for my game :)