object follow other object(air hockey in 3d)

hi friends, i am alka rajput.i m making a game like airhockey in 3 Dimensions. i want that when the ball come in certain region the AI player follow that ball after some time.

Say you're playing field is on the x and the z axis. Where the x axis is the long side of the field, and the origin is through the center of your field. Assume the AI is on the right and the player is on the left

  • if the x co-ordinate of the ball is positive it is on the enemies side

  • if if the movement on the x-axis is positive it is moving towards the enemy

if and when both of this is true you want:

  • the z position of the ball to be the target position of the AI

  • move the AI from it's current position towards the target position over time

use this as a reference when scripting, and please try it on your own before asking for more help :) good luck with it!