• Advertisement
Sign in to follow this  

ummm, I have a Question

This topic is 4495 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, my question is a little different from the usual. What I have is a quarterback challenge game. In my game you just throw a football at recievers that are running routes. When you throw the football the ball travels to an invisible "x" which is where the receiver is headed. My problem is, the recievers have all different speeds and so sometimes the slow receivers don't make it to the "x" before the ball gets there. What I need have is the distance between the "x" and the receiver in proportion to the receiver's speed. Think you know?

Share this post


Link to post
Share on other sites
Advertisement
I think what you want is how long it would take the reciever to get there. Velocity(speed and direction) = distance/time . Therefore time = distance/velocity .

Share this post


Link to post
Share on other sites
you could move the x by the same velocity as the runner, except mult it by, lets say a float called 'diffX' so it's always ahead of him. then play around with it to see what value of 'diffX' gets the player to catch the ball most of the time. i'd imagine you wouldn't want it absolutly perferct because sometimes people fumble the ball, but that's just my assumption.

not very elegant, but whatever works.

Share this post


Link to post
Share on other sites
Say the distance between the QB and X is called DQB.
Also, let the distance between the receiver and X be DR.
Lastly, the speed of the receiver is VR.

You need the speed of the quarterback's thrown ball to be such that the ball covers DQB in the same time it takes the receiver to cover DR.

So, to find that time:
T = DR / VR;

Then, to find the velocity of the ball, we divide the distance by that time:
VQB = DQB / T;

Or, in one step:
VQB = VR * DQB / DR;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement