Hey Don

This is the code I'm using from your math:

 Code:
vec_to_angle(temp.x,vec_diff(temp,my.x,ball_ent.x));
vec_to_angle(temp2.x,vec_diff(temp2,vector(ball_ent.x + ball_ent.velocity_x,ball_ent.y + ball_ent.velocity_y,ball_ent.z),ball_ent.x));
result = ang(temp.x - temp2.x);

time_calc = vec_dist(my.x, ball_ent.x)/(my.movement_speed+my.movement_speed);
my.time_to_ball = time_calc*cos(result); //angle delta is angle between (ball-guy & ball–Goal)


I'm not sure what it is but it simply fails to work properly in practice...could be my code, could be your math, I'm not sure. Thank you for the code.

I'm using my.movement_speed as the ball's speed value, that's deliberate.

Assuming the ball's speed is 0, this fails to work until I remove "*cos(result)"

 Code:
time_calc = vec_dist(my.x, ball_ent.x)/(my.movement_speed);
my.time_to_ball = time_calc*cos(result); //angle delta is angle between (ball-guy & ball–Goal)


David

Last edited by DavidLancaster; 04/10/08 07:31.