I used the Unity game engine and its physics to interact with the hoop. As for the ball's motion, it was all physics and vector calculations! I have an explanation on the website ronjoshi.github.io.