I am making an air hockey game on Android with Box2D and libgdx. For the manual control, I just use the MouseJoint and it works perfectly. However, for the AI control, there is a problem:
I've made a method predicting the position of the puck in the near future (for example in the next 30 frames). Then I tried to move the paddle towards that predicted position such as: after exactly 30 frames, my paddle will arrive in time at a specified point near that position to hit the puck with a specified velocity.
But the problem is, if using MouseJoint, I can't specify the exact interval 30 frames. The paddle will arrive at the specified position, but it maybe sooner than 30 frames, or later than 30 frames. And I can't control the velocity when it arrive at that point either.
What I need here is a way to control my paddle to arrive at a specified point, with a specified velocity in a specified interval. Or is there any other way to control this AI paddle?