- Home /
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.
Answer by Joshua · Apr 23, 2011 at 12:24 PM
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!
Your answer
Follow this Question
Related Questions
Destroy an object with another one. 1 Answer
How to make weapon follow player arm when player model has been merged into one mesh? 1 Answer
object follow mouse position in 3d world. 1 Answer
Need Help: Unity draw-to-follow? 0 Answers
How to make two rays with different offset follow objects rotation? 1 Answer