This may be a "best way to" question, so may be susceptible to opinion-based answers (which is ok for me). But I would also like if there are any tutorials , research papers , etc.
I'm trying to make a 3D free kick game, and I want to decide on the Goalkeeper algorithm.
Usually (and in my game) the shot is a function of
swerve. Maybe wind can be a factor too. So the shots trajectory is pre-deterministic, i.e., the point that intersects the goal (or out) plane is determined as soon as the shot fires.
So what could be a good approach for the goalkeeper to jump (or walk) ?
I have two approaches in mind :
1- determine the point, and jump to there. 2- when the ball is closer than a threshold distance, estimate the point by the ball's velocity vector, and jump to there.
The problem with the first approach is, goalkeeper will always save the shot, which I want to prevent. So there should be some kind of randomness, or the goalkeeper's ability to jump and walk will be restricted.
The problem with the second approach is, when there is a high amount of swerve, the goalkeeper will always fail to save the shot.
So how could these approaches be better?
Thanks for any help !
if you want to play the game, click here