Unity 5 – Trouble with Raycasting for a Pong Clone Opponent AI

Hi there!I’m running into some trouble programming the opponent in this Pong clone where I want it to predict where the ball would be when it’s coming towards it at the paddle zone. What I’m using to predict the ball’s position relative to the Z-axis (which is where the the paddles move freely) is raycasting, tags, layers, and colliders; those are checked if the difficulty setting is on medium or hard mode when the ball triggers the opponent’s ball detector. The code and some debugging output is provided here:http://answers.unity3d.com/questions/1229543/gpd-pong-trouble-with-raycasting-for-opponents-loo.html What I’m basically doing in those difficulties is having the opponent predict the position in only two cases: when the ball has a straight path towards the opponent, and when the ball is one collision from the walls away from the…


Link to Full Article: Unity 5 – Trouble with Raycasting for a Pong Clone Opponent AI