4 ms·
Actually, I did this for a 3-D minigolf game I made about 20 years ago. The algorithm isn't hard. You have a rather small parameter space of possible hits (di
by Simon_says 9y ago
Actually, I did this for a 3-D minigolf game I made about 20 years ago. The algorithm isn't hard. You have a rather small parameter space of possible hits (direction plus velocity). In my game it was a 3-dimensional parameter space. For his, it would be a 2-dimensional parameter space. The output is the distance from the hole to the ball when it stops moving. This is just a minimization problem. Try a bunch of experiments and refine the better ones. Worked for me.
It is technically true that it's possible there might be a solution that your search won't find. But I never found an example of that occurring for my game. So if you follow this, you may inadvertently throw out a hard level that has a solution, but you'd never present the player with a level that has no solution.